From Xojo Documentation


String.ToText() As Text

Supported for all project types and targets.

Converts the String to a Text value provided there is a valid encoding on the String.


If the String does not have a valid encoding (such as it is Nil) then a Xojo.Core.BadDataException is raised. You can define an encoding for the String using DefineEncoding.

Sample Code

Convert a String to Text:

Var t As Text
Var s As String = "Hello"
t = s.ToString

Append an EndOfLine (which is a String) to a Text:

Var t As Text = "Hello"
t = t + EndOfLine.macOS.ToText

See Also

Text data type