Thanks to visit codestin.com
Credit goes to www.scribd.com

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

Complete-Reference-Vb Net 14

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)
5 views1 page

Complete-Reference-Vb Net 14

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

Concat

Dim sText1, sText2 As String


Dim num As Integer
sText1 = "hello human"
sText2 = "hello human"
num = sText1.CompareTo(sText2)
Console.WriteLine("Result: {0}", CStr(num))

The String objects are equal.

Concat

The Concat method concatenates (joins) two or more Strings together. The result is a new, third String that
is the combination of String values of the source and target objects and that contains the concatenated
Strings. The syntax is as follows:

ing1.Concat(ing2)

or

String.Concat(ing1, ing2)

which joins ing1 and ing2 to form a new String. However, the method can take up to three Strings and has
application in Array types. The following code shows how you can concat three String values:

Dim ing1, ing2, ing3 As String


ing1 = "Florida, "
ing2 = "we have a (voting) problem."
Console.WriteLine(String.Concat(ing1, ing2, ing3))

The output to the console is the String representation of ing3, which is the concatenation of ing1 and ing2.
Note that the original Strings ing1 and ing2 are not modified in any way. The result to the console is as
follows:

Florida, we have a (voting) problem.

Copy

The Copy method provides a simple means of copying one String object to another. The original value is left
untouched. The Copy syntax is demonstrated in the following example:

Dim ing1, ing2 As String


ing1 = "Florida, we have a (voting) problem."
Console.WriteLine(ing2.Copy(ing1))

If you cannot guess what gets written to the console, then you have a problem. You do not need to forward
declare a source String object to copy from, as the following example illustrates:

Dim orida As String


Console.WriteLine(orida.Copy("Florida, we have a (voting) problem."))

498

You might also like