Copy a string: Difference between revisions

→‎[[Toka]]: Added VB
(→‎[[Java]]: Changed example so it shows aliasing and fixed a typo in it.)
(→‎[[Toka]]: Added VB)
Line 239:
" hello" is-data a
a string.clone is-data b
 
==[[Visual Basic .NET]]==
[[Category:Visual Basic .NET]]
 
'''Platform:''' [[.NET]]
 
'''Language Version:''' 9.0+
 
'Immutable Strings
Dim a = "Test string"
Dim b = a 'reference to same string
Dim c = New String(a.ToCharArray) 'new string, normally not used
'Mutable Strings
Dim x As New Text.StringBuilder("Test string")
Dim y = x 'reference
Dim z = New Text.StringBuilder(x.ToString) 'new string