Skip to content

Class Text

Kristian Virtanen edited this page Oct 16, 2024 · 2 revisions

Description:

The Text class provides methods for performing text manipulations such as concatenation, searching, case conversion, and substring operations. The class also includes error handling via the LastError property, which stores the most recent error message if an operation fails.

Properties

Text.LastError

  • Description: Stores the last error message, if any operation fails, including a timestamp in yyyy-MM-dd HH:mm:ss format.
  • Example: "2024-10-16 14:30:00: Invalid substring operation."

Methods

Text.Append(text1, text2)

  • Description: Appends two text inputs and returns the result.
  • Parameters:
    • text1: The first text input.
    • text2: The second text input to append.
  • Returns: The result of appending text2 to text1.

Text.GetLength(text)

  • Description: Returns the length of the given text.
  • Parameters:
    • text: The input text.
  • Returns: The length of the text.

Text.IsSubText(text, subtext)

  • Description: Checks if subText is part of the main text.
  • Parameters:
    • text: The main text to search within.
    • subText: The text to search for within the main text.
  • Returns: true if subText is found in the main text, otherwise false.

Text.EndsWith(text, subText)

  • Description: Checks if the text ends with the specified subText.
  • Parameters:
    • text: The main text.
    • subText: The text to check for at the end of the main text.
  • Returns: true if the main text ends with subText, otherwise false.

Text.StartsWith(text, subtext)

  • Description: Checks if the text starts with the specified subText.
  • Parameters:
    • text: The main text.
    • subText: The text to check for at the beginning of the main text.
  • Returns: true if the main text starts with subText, otherwise false.

Text.GetSubText(text, start, length)

  • Description: Gets a substring from the given text, starting at a specified position and with the given length.
  • Parameters:
    • text: The input text.
    • start: The starting position (1-based index).
    • length: The number of characters to include in the substring.
  • Returns: The substring from the specified position and length.

Text.GetSubTextToEnd(text, start)

  • Description: Gets a substring from the given text, starting at a specified position and extending to the end of the text.
  • Parameters:
    • text: The input text.
    • start: The starting position (1-based index).
  • Returns: The substring from the specified starting position to the end of the text.

Text.GetIndexOf(text, subText)

  • Description: Finds the position where subText first appears in the main text.
  • Parameters:
    • text: The main text to search within.
    • subText: The text to find within the main text.
  • Returns: The 1-based index of the first occurrence of subText, or 0 if not found.

Text.ConvertToLowerCase(text)

  • Description: Converts the given text to lowercase.
  • Parameters:
    • text: The input text.
  • Returns: The input text converted to lowercase.

Text.ConvertToUpperCase(text)

  • Description: Converts the given text to uppercase.
  • Parameters:
    • text: The input text.
  • Returns: The input text converted to uppercase.

Text.GetCharacter(characterCode)

  • Description: Gets a character corresponding to the specified Unicode code.
  • Parameters:
    • characterCode: The Unicode code of the character.
  • Returns: The character that corresponds to the specified Unicode code.

Text.GetCharacterCode(character)

  • Description: Gets the Unicode code for the specified character.
  • Parameters:
    • character: The character to get the Unicode code for.
  • Returns: The Unicode code of the specified character.

Text.InvertText(text)

  • Description: Inverts the given text.
  • Parameters:
    • text: The text to invert.
  • Returns: The inverted text.

Text.Str(number)

  • Description: Converts a number to a string.
  • Parameters:
    • number: The number to convert.
  • Returns: The string representation of the number.

Top

Clone this wiki locally