Microsoft Small Basic


Text

The Text object provides helpful operations for working with Text.

Operations

Append

Text.Append(text1, text2)

Appends two text inputs and returns the result as another text. This operation is particularly useful when dealing with unknown text in variables which could accidentally be treated as numbers and get added, instead of getting appended.

text1

First part of the text to be appended.

text2

Second part of the text to be appended.

Returns

The appended text containing both the specified parts.

GetLength

Text.GetLength(text)

Gets the length of the given text.

text

The text whose length is needed.

Returns

The length of the given text.

IsSubText

Text.IsSubText(text, subText)

Gets whether or not a given subText is a subset of the larger text.

text

The larger text within which the sub-text will be searched.

subText

The sub-text to search for.

Returns

True if the subtext was found within the given text.

EndsWith

Text.EndsWith(text, subText)

Gets whether or not a given text ends with the specified subText.

text

The larger text to search within.

subText

The sub-text to search for.

Returns

True if the subtext was found at the end of the given text.

StartsWith

Text.StartsWith(text, subText)

Gets whether or not a given text starts with the specified subText.

text

The larger text to search within.

subText

The sub-text to search for.

Returns

True if the subtext was found at the start of the given text.

GetSubText

Text.GetSubText(text, start, length)

Gets a sub-text from the given text.

text

The text to derive the sub-text from.

start

Specifies where to start from.

length

Specifies the length of the sub text.

Returns

The requested sub-text

GetSubTextToEnd

Text.GetSubTextToEnd(text, start)

Gets a sub-text from the given text from a specified position to the end.

text

The text to derive the sub-text from.

start

Specifies where to start from.

Returns

The requested sub-text.

GetIndexOf

Text.GetIndexOf(text, subText)

Finds the position where a sub-text appears in the specified text.

text

The text to search in.

subText

The text to search for.

Returns

The position at which the sub-text appears in the specified text. If the text doesn't appear, it returns 0.

ConvertToLowerCase

Text.ConvertToLowerCase(text)

Converts the given text to lower case.

text

The text to convert to lower case.

Returns

The lower case version of the given text.

ConvertToUpperCase

Text.ConvertToUpperCase(text)

Converts the given text to upper case.

text

The text to convert to upper case.

Returns

The upper case version of the given text.

GetCharacter

Text.GetCharacter(characterCode)

Given the unicode character code, gets the corresponding character, which can then be used with regular text.

characterCode

The character code (Unicode based) for the required character.

Returns

A unicode character that corresponds to the code specified.

GetCharacterCode

Text.GetCharacterCode(character)

Given a unicode character, gets the corresponding character code.

character

The character whose code is requested.

Returns

A unicode based code that corresponds to the character specified.