String

From REALbasicWiki

Jump to: navigation, search

String is a datatype used for storing a series of bytes.

String variables and properties are initialized by the compiler to the empty string "".

REALbasic strings are immutable.

[edit] Discussion

Text is a string, plus an encoding. The encoding describes how to interpret the bytes of the string as characters.

You can retrieve the encoding of a string using the Encoding function.

dim enc as TextEncoding = Encoding("foo")

Given a string with no encoding, you can assign one using the function DefineEncoding. Usually you need to do this only when getting a string from an external source such as a file or socket, or from a MemoryBlock.

ConvertEncoding takes a string having an encoding, and returns a new string with the specified encoding.


[edit] Sample Code

 Dim s As String = "Hello, World!"
Personal tools
related