Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

10. The Class Library, Part 1 > String Operations

String Operations

Like the Char structure, the String structure exposes methods to help you manipulate them. Most of them work the way you’d expect them to. For example, what would you expect the value of IsIn in the following snippet to be?

MyString As String = "Hello"
IsIn As Boolean = MyString.Contains("ll")

No prizes for saying IsIn is True.

But one very common operation deserves special consideration. The Concat() methods, all of which are static, simply slap one argument on the end of the other. (“Concat” is short for “concatenate”. Programmers never use a simple word like “combine” if they can avoid it.) There are several overloads of Concat() that allow you to combine objects of various types, but most often you’ll be combining one String with another, and you can use the + operator as a shorthand for that operation. For example, the following statement sets MyString to “Hello, World!”:


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial