0% found this document useful (0 votes)
10 views1 page

Complete-Reference-Vb Net 20

Uploaded by

khalid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views1 page

Complete-Reference-Vb Net 20

Uploaded by

khalid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

ToCharArray

This returns just the word "cow" to the console.

ToCharArray

The ToCharArray method lets you copy a String to a character array. You can easily reference the character
array as follows:

Dim str As String = "Holy cow"


Console.WriteLine(str.ToCharArray(0, 2))

The console output is as follows:

ho

ToLower, ToUpper

Often, you might need to convert characters to either upper− or lowercase. The methods ToLower and
ToUpper allow you to toggle text as lower− or uppercase. For example, the code

Dim str As String = "holy cow"


str = str.ToUpper()
Console.WriteLine(str)

writes HOLY COW to the console. ToLower converts uppercase to lowercase. Incidentally, the method does
not take an argument.

Trim, TrimEnd, TrimStart

The trim functions let you trim white spaces from the beginning and end of Strings. Trim lets you trim the
start and end of Strings with one call.

Classic Visual Basic String Functions


In addition to the String object's methods, the legacy−style VB functions listed in Table 15−3 are also
supported by Visual Basic .NET. These are accessible via the Microsoft.VisualBasic.Strings namespace.

Table 15−3: Classic Functions Wrapped by the Microsoft.VisualBasic.Strings Class

What You Need to Do Function to Use


Compares two Strings StrComp
Converts Strings according to constants supplied to the function StrConv
Returns a String or object consisting of the specified character repeated the StrDup
specified number of times
Returns a String in which the character order of a specified String is StrReverse, InStrRev
reversed
Converts Strings from uppercase to lowercase and vice versa LCase, UCase
Inserts spaces in Strings Space
Determines the length of a String Len

504

You might also like