-
Notifications
You must be signed in to change notification settings - Fork 0
Class Text
Kristian Virtanen edited this page Oct 28, 2024
·
2 revisions
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.
-
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."
- Changes from orig. SB: New feature for SBOE.
- 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
totext1
. - Changes from orig. SB: none.
- Description: Returns the length of the given text.
-
Parameters:
-
text
: The input text.
-
- Returns: The length of the text.
- Changes from orig. SB: none.
-
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
ifsubText
is found in the main text, otherwisefalse
. - Changes from orig. SB: none.
-
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 withsubText
, otherwisefalse
. - Changes from orig. SB: none.
-
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 withsubText
, otherwisefalse
. - Changes from orig. SB: none.
- 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.
- Changes from orig. SB: none.
- 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.
- Changes from orig. SB: none.
-
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
, or0
if not found. - Changes from orig. SB: none.
- Description: Converts the given text to lowercase.
-
Parameters:
-
text
: The input text.
-
- Returns: The input text converted to lowercase.
- Changes from orig. SB: none.
- Description: Converts the given text to uppercase.
-
Parameters:
-
text
: The input text.
-
- Returns: The input text converted to uppercase.
- Changes from orig. SB: none.
- 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.
- Changes from orig. SB: none.
- 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.
- Changes from orig. SB: none.
- Description: Inverts the given text.
-
Parameters:
-
text
: The text to invert.
-
- Returns: The inverted text.
- Changes from orig. SB: New feature for SBOE.
-
Description: Trims leading whitespaces away from string. IE:
" abc"
returns as"abc"
-
Parameters:
-
text
: The text to trim.
-
- Returns: The trimmed text.
- Changes from orig. SB: New feature for SBOE.
-
Description: Trims trailing whitespaces away from string. IE:
" abc "
returns as" abc"
-
Parameters:
-
text
: The text to trim.
-
- Returns: The trimmed text.
- Changes from orig. SB: New feature for SBOE.
-
Description: Trims leading and trailing whitespaces away from string. IE:
" abc "
returns as"abc"
-
Parameters:
-
text
: The text to trim.
-
- Returns: The trimmed text.
- Changes from orig. SB: New feature for SBOE.
- Description: Converts a number to a string.
-
Parameters:
-
number
: The number to convert.
-
- Returns: The string representation of the number.
- Changes from orig. SB: New feature for SBOE.