Library code snippets
String Concatenation
To join two strings together in Visual Basic, you use the & operator. For example,
sString = "hello " & sName
Combines the text "hello " and the value of sName, and saves it in the sString variable. An operator that is notably missing in VB 6 an earlier is a way to append a string to another. In VB 6 or earlier, you have to do
sString = sString & " goodbye!"
Which adds " goodbye" to the end of sString. However, this can be extremely inefficient when performing the operation multiple times, or on large strings. (For performance comparisons with a C++ equivilant, take a look here). Fortunately, with VB.NET, the language has been brought into line with most others, and you can now do
sString .= " goodbye!"
instead.
Related articles
Related discussion
-
Problem with migration to C# (CoCreateInstanceEx)
by LRollison (1 replies)
-
VB6 Problem Creating Shortcuts
by rb1177 (0 replies)
-
how can i open a file
by kyawswarhtun (0 replies)
-
how to save any one form what i want?
by blackguy (5 replies)
-
Build an MP3 Player
by soybees (4 replies)
Related podcasts
-
Christian Beauclair
14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...
say uve got three string in a sentance time|title|location , there broken by the | how would u split the three strings in 3 individual strings again??
i know how to find info before and after a | but not breaking down three strings
any help would be appreciated
This thread is for discussions of String Concatenation.