Copy a string: Difference between revisions

Content deleted Content added
PureFox (talk | contribs)
Added FreeBASIC
Line 523:
Because Fortran uses fixed length character strings if str1 is shorter than str2 then str2 is padded out with trailing spaces.
If str1 is longer than str2 it is truncated to fit.
 
=={{header|FreeBASIC}}==
<lang freebasic>' FB 1.05.0 Win64
 
Dim s As String = "This is a string"
Dim t As String = s
' a separate copy of the string contents has been made as can be seen from the addresses
Print s, StrPtr(s)
Print t, StrPtr(t)
' to refer to the same string a pointer needs to be used
Dim u As String Ptr = @s
Print
Print *u, StrPtr(*u)
Sleep</lang>
 
{{out}}
<pre>
This is a string 10623504
This is a string 10623552
 
This is a string 10623504
</pre>
 
=={{header|FutureBasic}}==