-
Notifications
You must be signed in to change notification settings - Fork 0
Class Text
Kristian Virtanen edited this page Oct 16, 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."
- 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
.
- Description: Returns the length of the given text.
-
Parameters:
-
text
: The input text.
-
- Returns: The length of the text.
-
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
.
-
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
.
-
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
.
- 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.
- 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.
-
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.
- Description: Converts the given text to lowercase.
-
Parameters:
-
text
: The input text.
-
- Returns: The input text converted to lowercase.
- Description: Converts the given text to uppercase.
-
Parameters:
-
text
: The input text.
-
- Returns: The input text converted to uppercase.
- 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.
- 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.
- Description: Inverts the given text.
-
Parameters:
-
text
: The text to invert.
-
- Returns: The inverted text.
- Description: Converts a number to a string.
-
Parameters:
-
number
: The number to convert.
-
- Returns: The string representation of the number.