Text Library


Abstract

The VCSSL Text library is a standard library for text processing.

This library provides features such as obtaining lengths and substrings,searching and replacing, and splitting for string variables.Regular expressions can also be used in searching, replacing, and splitting.


Index

const int ALL
The search mode for finding all parts matching a string.
const int ALL_PATTERN
The search mode for finding all parts matching a regular expression.
const int FIRST
The search mode for finding the first part matching a string.
const int FIRST_PATTERN
The search mode for finding the first part matching a regular expression.
const int LAST
The search mode for finding the last part matching a string.
const int LAST_PATTERN
The search mode for finding the last part matching a regular expression.
const int START
The checking mode for determining whether the beginning of a string matches a substring.
const int START_PATTERN
The checking mode for determining whether the beginning of a string matches a regular expression.
const int END
The checking mode for determining whether the end of a string matches a substring.
const int END_PATTERN
The checking mode for determining whether the end of a string matches a regular expression.
const int CONTAIN
The checking mode for determining whether any part of a string matches a substring.
const int CONTAIN_PATTERN
The checking mode for determining whether any part of a string matches a regular expression.
const int FULL_PATTERN
The checking mode for determining whether an entire string matches a regular expression.
const int TRIM
The mode of the adjustText function for trimming leading and trailing whitespace and line breaks.
const int LOWER_CASE
The mode of the adjustText function for converting uppercase alphabetic characters to lowercase.
const int UPPER_CASE
The mode of the adjustText function for converting lowercase alphabetic characters to uppercase.
string atText( string text, int index )
Returns the character at the specified index in a string as a one-character string value.
bool checkText( string text, string query, int mode )
Determines whether the beginning, end, or whole of a string matches the specified string or regular expression.
string adjustText( string text, int mode )
Adjusts text in the specified mode.Depending on the mode, leading and trailing whitespace and line breaks can be removed, or alphabetic characters can be unified to uppercase or lowercase.
string cropText( string text, int cropBegin, int cropEnd )
Returns the specified range extracted from a text.If indices are assigned to the characters of the text starting from 0, the extracted range is the substring from cropBegin to cropEnd - 1.Also, if indices are assigned to the gaps between characters, the extracted range is exactly the part between the gap at cropBegin and the gap at cropEnd.
int countText( string text )
Counts and returns the number of characters in a text.
int countText( string text, string query, int mode )
Searches a text for parts matching a substring or regular expression, and returns the number of matches.
int countText( string text, string query, int searchBegin, int mode )
Searches a text for parts matching a substring or regular expression from the specified position onward, and returns the number of matches.
int countText( string text, string query, int searchBegin, int searchEnd, int mode )
Searches within the specified range of a text for parts matching a substring or regular expression, and returns the number of matches.
int[ ] findText( string text, string query, int mode )
Searches a text for parts matching a substring or regular expression, and returns an array containing the character indices of the matched parts.
int[ ] findText( string text, string query, int searchBegin, int mode )
Searches from the specified position onward in a text for parts matching a substring or regular expression, and returns an array containing the character indices of the matched parts.If no match is found, the return value is an array with zero elements.
int[ ] findText( string text, string query, int searchBegin, int searchEnd, int mode )
Searches within the specified range of a text for parts matching a substring or regular expression, and returns an array containing the character indices of the matched parts.If no match is found, the return value is an array with zero elements.
string[ ] extractText( string text, string query, int mode )
Searches a text for parts matching a substring or regular expression, and returns an array containing the extracted matched strings.If no match is found, the return value is an array with zero elements.
string[ ] extractText( string text, string query, int searchBegin, int mode )
Searches from the specified position onward in a text for parts matching a substring or regular expression, and returns an array containing the extracted matched strings.If no match is found, the return value is an array with zero elements.
string[ ] extractText( string text, string query, int searchBegin, int searchEnd, int mode )
Searches within the specified range of a text for parts matching a substring or regular expression, and returns an array containing the extracted matched strings.If no match is found, the return value is an array with zero elements.
string replaceText( string text, string query, string newPart, int mode )
Searches a text for parts matching a substring or regular expression, and returns the text with the matched parts replaced by another string.
string replaceText( string text, string query, string newPart, int searchBegin, int mode )
Searches from the specified position onward in a text for parts matching a substring or regular expression, and returns the text with the matched parts replaced by another string.
string replaceText( string text, string query, string newPart, int searchBegin, int searchEnd, int mode )
Searches within the specified range of a text for parts matching a substring or regular expression, and returns the text with the matched parts replaced by another string.
string[ ] splitText( string text, string query, int mode )
Searches a text for parts matching a substring or regular expression, and returns an array containing the original text split at those matched parts.
string[ ] splitText( string text, string query, int searchBegin, int mode )
Searches from the specified position onward in a text for parts matching a substring or regular expression, and returns an array containing the original text split at those matched parts.
string[ ] splitText( string text, string query, int searchBegin, int searchEnd, int mode )
Searches within the specified range of a text for parts matching a substring or regular expression, and returns an array containing the original text split at those matched parts.
string[ ] split( string text, string query )
Splits a string at positions matching a specific string, and returns the result as an array.Currently, the newer splitText function is supported and provides the same or more advanced functionality.For example, splitText(text, query, ALL) gives the same result as this function.This function is supported for compatibility.Note that in this function, if query exists exactly at the end of the argument text, it is not regarded as being followed by an empty string, and no empty string is stored in the last element of the returned array.This behavior differs from splitText, but it will not be changed in order to preserve compatibility.
string[ ] splitPattern( string text, string query )
Splits a string at positions matching a specific regular expression, and returns the result as an array.Currently, the newer splitText function is supported and provides the same or more advanced functionality.For example, splitText(text, query, ALL_PATTERN) gives the same result as this function.This function is supported for compatibility.Note that in this function, if query exists exactly at the end of the argument text, it is not regarded as being followed by an empty string, and no empty string is stored in the last element of the returned array.This behavior differs from splitText, but it will not be changed in order to preserve compatibility.
string replace( string text, string oldText, string newText )
Returns a string in which all occurrences of a substring contained in a string are replaced with another substring.Currently, the newer replaceText function is supported and provides the same or more advanced functionality.For example, replaceText(text, query, ALL) gives the same result as this function.This function is supported for compatibility.
string replacePattern( string text, string oldText, string newText )
Returns a string in which all ranges matching a regular expression in a string are replaced with another substring.Currently, the newer replaceText function is supported and provides the same or more advanced functionality.For example, replaceText(text, query, ALL_PATTERN) gives the same result as this function.This function is supported for compatibility.
string replaceFirst( string text, string oldText, string newText )
Returns a string in which only the first occurrence of a substring contained in a string is replaced with another substring.Currently, the newer replaceText function is supported and provides the same or more advanced functionality.For example, replaceText(text, query, FIRST) gives the same result as this function.This function is supported for compatibility.
string replaceFirstPattern( string text, string oldText, string newText )
Returns a string in which only the first range matching a regular expression in a string is replaced with another substring.Currently, the newer replaceText function is supported and provides the same or more advanced functionality.For example, replaceText(text, query, FIRST_PATTERN) gives the same result as this function.This function is supported for compatibility.
string replaceFirst( string text, string oldText, string newText, int start )
Returns a string in which a substring is replaced with another substring.If multiple matching substrings exist, only the first one at or after the index specified by the argument start is replaced.Currently, the newer replaceText function is supported and provides the same or more advanced functionality.For example, replaceText(text, query, start, FIRST) gives the same result as this function.This function is supported for compatibility.
string replaceFirstPattern( string text, string oldText, string newText, int start )
Returns a string in which a range matching a regular expression is replaced with another substring.If multiple matching ranges exist, only the first one at or after the index specified by the argument start is replaced.Currently, the newer replaceText function is supported and provides the same or more advanced functionality.For example, replaceText(text, query, start, FIRST_PATTERN) gives the same result as this function.This function is supported for compatibility.
string substring( string text, int start, int end )
Returns the substring in the specified index range within a string.Currently, the newer cropText function is supported and provides the same functionality.For example, cropText(text, start, end) gives the same result as this function.This function is supported for compatibility.
int lengthOf( string text )
Returns the number of characters in a string.Currently, the newer countText function is supported and provides the same functionality.For example, countText(text) gives the same result as this function.This function is supported for compatibility.
bool startsWith( string text, string word )
Determines whether a string starts with the specified substring.Currently, the newer checkText function is supported and provides the same functionality.For example, checkText(text, word, START) gives the same result as this function.This function is supported for compatibility.
bool endsWith( string text, string word )
Determines whether a string ends with the specified substring.Currently, the newer checkText function is supported and provides the same functionality.For example, checkText(text, word, END) gives the same result as this function.This function is supported for compatibility.
string match( string text, string pattern )
Use of this API is not recommended.Currently, the newer extractText function is supported and provides the same functionality.For example, extractText(text, pattern, FIRST_PATTERN) gives the same result as this function.This function is supported for compatibility.
string match( string text, string pattern, int start )
Use of this API is not recommended.Currently, the newer extractText function is supported and provides the same functionality.For example, extractText(text, pattern, start, FIRST_PATTERN) gives the same result as this function.This function is supported for compatibility.
bool matchFull( string text, string pattern )
Determines whether an entire string matches a regular expression.Currently, the newer checkText function is supported and provides the same functionality.For example, checkText(text, word, FULL_PATTERN) gives the same result as this function.This function is supported for compatibility.
string matchFirst( string text, string pattern )
Extracts and returns the first part matching a regular expression from a string.Currently, the newer extractText function is supported and provides the same functionality.For example, extractText(text, pattern, FIRST_PATTERN) gives the same result as this function.This function is supported for compatibility.
string matchFirst( string text, string pattern, int start )
Extracts and returns a part matching a regular expression from a string.If multiple matching parts exist, only the first one at or after the index specified by the argument start is selected.Currently, the newer extractText function is supported and provides the same functionality.For example, extractText(text, pattern, start, FIRST_PATTERN) gives the same result as this function.This function is supported for compatibility.
string matchLast( string text, string pattern )
Extracts and returns the last part matching a regular expression from a string.Currently, the newer extractText function is supported and provides the same functionality.For example, extractText(text, pattern, LAST_PATTERN) gives the same result as this function.This function is supported for compatibility.
string matchLast( string text, string pattern, int end )
Extracts and returns a part matching a regular expression from a string.If multiple matching parts exist, only the last one before the position of the index specified by the argument end is selected.Currently, the newer extractText function is supported and provides the same functionality.For example, extractText(text, pattern, 0, end, LAST_PATTERN) gives the same result as this function.This function is supported for compatibility.
int indexOf( string text, string word )
Obtains the position of the specified substring in a string.If multiple occurrences exist, the first one is selected. If none exists, -1 is returned.Currently, the newer findText function is supported and provides the same functionality.For example, findText(text, word, FIRST) gives the same result as this function.(However, if there is no match, an array with zero elements is returned.)To determine whether a string contains a substring, you can use something like 0 < countText(text, word, ALL).This function is supported for compatibility.
int indexOf( string text, string word, int start )
Obtains the position of the specified substring in a string.If multiple occurrences exist, the first one at or after the index specified by the argument start is selected. If none exists, -1 is returned.Currently, the newer findText function is supported and provides the same functionality.For example, findText(text, word, start, FIRST) gives the same result as this function.(However, if there is no match, an array with zero elements is returned.)To determine whether a substring exists at or after the specified position in a string, you can use something like 0 < countText(text, word, start, ALL).This function is supported for compatibility.
string indexOfPattern( string text, string word )
Obtains the position of the specified regular expression match in a string.If multiple matches exist, the first one is selected. If none exists, -1 is returned.Currently, the newer findText function is supported and provides the same functionality.For example, findText(text, word, FIRST_PATTERN) gives the same result as this function.(However, if there is no match, an array with zero elements is returned.)This function is supported for compatibility.
string indexOfPattern( string text, string word, int start )
Obtains the position of the specified regular expression match in a string.If multiple matches exist, the first one at or after the index specified by the argument start is selected. If none exists, -1 is returned.Currently, the newer findText function is supported and provides the same functionality.For example, findText(text, word, start, FIRST_PATTERN) gives the same result as this function.(However, if there is no match, an array with zero elements is returned.)This function is supported for compatibility.
int lastIndexOf( string text, string word )
Obtains the position of the specified substring in a string.If multiple occurrences exist, the last one is selected. If none exists, -1 is returned.Currently, the newer findText function is supported and provides the same functionality.For example, findText(text, word, LAST) gives the same result as this function.(However, if there is no match, an array with zero elements is returned.)This function is supported for compatibility.
int lastIndexOf( string text, string word, int end )
Obtains the position of the specified substring in a string.If multiple occurrences exist, the last one before or at the index specified by the argument end is selected. If none exists, -1 is returned.Currently, the newer findText function is supported and provides the same functionality.For example, findText(text, word, 0, end, LAST) gives the same result as this function.(However, if there is no match, an array with zero elements is returned.)This function is supported for compatibility.
string lastIndexOfPattern( string text, string word )
Obtains the position of the specified regular expression match in a string.If multiple matches exist, the last one is selected. If none exists, -1 is returned.Currently, the newer findText function is supported and provides the same functionality.For example, findText(text, word, LAST_PATTERN) gives the same result as this function.(However, if there is no match, an array with zero elements is returned.)This function is supported for compatibility.
string lastIndexOfPattern( string text, string word, int end )
Obtains the position of the specified regular expression match in a string.If multiple matches exist, the last one before or at the index specified by the argument end is selected. If none exists, -1 is returned.Currently, the newer findText function is supported and provides the same functionality.For example, findText(text, word, 0, end, LAST_PATTERN) gives the same result as this function.(However, if there is no match, an array with zero elements is returned.)This function is supported for compatibility.
string charAt( string text, int index )
Returns the character at the specified index in a string.Currently, the newer atText function is supported and provides the same functionality.For example, atText(text, index) gives the same result as this function.This function is supported for compatibility.
string[ ] tokenize( string text )
Splits a string into tokens separated by spaces, tabs, or line breaks, and returns them as an array.

Structs

- None -


Variables

Name ALL
Declaration const int ALL
Description The search mode for finding all parts matching a string.
Name ALL_PATTERN
Declaration const int ALL_PATTERN
Description The search mode for finding all parts matching a regular expression.
Name FIRST
Declaration const int FIRST
Description The search mode for finding the first part matching a string.
Name FIRST_PATTERN
Declaration const int FIRST_PATTERN
Description The search mode for finding the first part matching a regular expression.
Name LAST
Declaration const int LAST
Description The search mode for finding the last part matching a string.
Name LAST_PATTERN
Declaration const int LAST_PATTERN
Description The search mode for finding the last part matching a regular expression.
Name START
Declaration const int START
Description The checking mode for determining whether the beginning of a string matches a substring.
Name START_PATTERN
Declaration const int START_PATTERN
Description The checking mode for determining whether the beginning of a string matches a regular expression.
Name END
Declaration const int END
Description The checking mode for determining whether the end of a string matches a substring.
Name END_PATTERN
Declaration const int END_PATTERN
Description The checking mode for determining whether the end of a string matches a regular expression.
Name CONTAIN
Declaration const int CONTAIN
Description The checking mode for determining whether any part of a string matches a substring.
Name CONTAIN_PATTERN
Declaration const int CONTAIN_PATTERN
Description The checking mode for determining whether any part of a string matches a regular expression.
Name FULL_PATTERN
Declaration const int FULL_PATTERN
Description The checking mode for determining whether an entire string matches a regular expression.
Name TRIM
Declaration const int TRIM
Description The mode of the adjustText function for trimming leading and trailing whitespace and line breaks.
Name LOWER_CASE
Declaration const int LOWER_CASE
Description The mode of the adjustText function for converting uppercase alphabetic characters to lowercase.
Name UPPER_CASE
Declaration const int UPPER_CASE
Description The mode of the adjustText function for converting lowercase alphabetic characters to uppercase.

Functions

Name atText
Declaration string atText( string text, int index )
Description Returns the character at the specified index in a string as a one-character string value.
Parameters (string type) text : The target string.
(int type) index : The character index.
Return (string type) The character.
Name checkText
Declaration bool checkText( string text, string query, int mode )
Description Determines whether the beginning, end, or whole of a string matches the specified string or regular expression.
Parameters (string type) text : The target text.
(string type) query : The substring used for matching.
(int type) mode : The checking mode ( START, END, CONTAIN, START_PATTERN, END_PATTERN, CONTAIN_PATTERN, FULL_PATTERN ).
Return (bool type) The result of the check (true if matched).
Name adjustText
Declaration string adjustText( string text, int mode )
Description Adjusts text in the specified mode.
Depending on the mode, leading and trailing whitespace and line breaks can be removed, or alphabetic characters can be unified to uppercase or lowercase.
Parameters (string type) text : The target text.
(int type) mode : The adjustment mode ( TRIM, LOWER_CASE, UPPER_CASE ).
Return (string type) The adjusted text.
Name cropText
Declaration string cropText( string text, int cropBegin, int cropEnd )
Description Returns the specified range extracted from a text.
If indices are assigned to the characters of the text starting from 0, the extracted range is the substring from cropBegin to cropEnd - 1.Also, if indices are assigned to the gaps between characters, the extracted range is exactly the part between the gap at cropBegin and the gap at cropEnd.
Parameters (string type) text : The target text.
(int type) cropBegin : The starting position of the range to be extracted.
(int type) cropEnd : The ending position of the range to be extracted.
Return (string type) The extracted text.
Name countText
Declaration int countText( string text )
Description Counts and returns the number of characters in a text.
Parameters (string type) text : The target text.
Return (int type) The number of characters in the text.
Name countText
Declaration int countText( string text, string query, int mode )
Description Searches a text for parts matching a substring or regular expression, and returns the number of matches.
Parameters (string type) text : The target text.
(string type) query : The substring to search for.
(int type) mode : The search mode ( ALL, FIRST, LAST, ALL_PATTERN, FIRST_PATTERN, LAST_PATTERN ).
Return (int type) The number of matches.
Name countText
Declaration int countText( string text, string query, int searchBegin, int mode )
Description Searches a text for parts matching a substring or regular expression from the specified position onward, and returns the number of matches.
Parameters (string type) text : The target text.
(string type) query : The substring to search for.
(int type) searchBegin : The character index of the search starting position.
(int type) mode : The search mode ( ALL, FIRST, LAST, ALL_PATTERN, FIRST_PATTERN, LAST_PATTERN ).
Return (int type) The number of matches.
Name countText
Declaration int countText( string text, string query, int searchBegin, int searchEnd, int mode )
Description Searches within the specified range of a text for parts matching a substring or regular expression, and returns the number of matches.
Parameters (string type) text : The target text.
(string type) query : The substring to search for.
(int type) searchBegin : The character index of the search starting position.
(int type) searchEnd : The character index of the search ending position plus 1 (see cropText).
(int type) mode : The search mode ( ALL, FIRST, LAST, ALL_PATTERN, FIRST_PATTERN, LAST_PATTERN ).
Return (int type) The number of matches.
Name findText
Declaration int[ ] findText( string text, string query, int mode )
Description Searches a text for parts matching a substring or regular expression, and returns an array containing the character indices of the matched parts.
Parameters (string type) text : The target text.
(string type) query : The substring to search for.
(int type) mode : The search mode ( ALL, FIRST, LAST, ALL_PATTERN, FIRST_PATTERN, LAST_PATTERN ).
Return (int[] type) An array storing the character indices of the matched parts.
Name findText
Declaration int[ ] findText( string text, string query, int searchBegin, int mode )
Description Searches from the specified position onward in a text for parts matching a substring or regular expression, and returns an array containing the character indices of the matched parts.If no match is found, the return value is an array with zero elements.
Parameters (string type) text : The target text.
(string type) query : The substring to search for.
(int type) searchBegin : The character index of the search starting position.
(int type) mode : The search mode ( ALL, FIRST, LAST, ALL_PATTERN, FIRST_PATTERN, LAST_PATTERN ).
Return (int[] type) An array storing the character indices of the matched parts.
Name findText
Declaration int[ ] findText( string text, string query, int searchBegin, int searchEnd, int mode )
Description Searches within the specified range of a text for parts matching a substring or regular expression, and returns an array containing the character indices of the matched parts.If no match is found, the return value is an array with zero elements.
Parameters (string type) text : The target text.
(string type) query : The substring to search for.
(int type) searchBegin : The character index of the search starting position.
(int type) searchEnd : The character index of the search ending position plus 1 (see cropText).
(int type) mode : The search mode ( ALL, FIRST, LAST, ALL_PATTERN, FIRST_PATTERN, LAST_PATTERN ).
Return (int[] type) An array storing the character indices of the matched parts.
Name extractText
Declaration string[ ] extractText( string text, string query, int mode )
Description Searches a text for parts matching a substring or regular expression, and returns an array containing the extracted matched strings.If no match is found, the return value is an array with zero elements.
Parameters (string type) text : The target text.
(string type) query : The substring to search for.
(int type) mode : The search mode ( ALL, FIRST, LAST, ALL_PATTERN, FIRST_PATTERN, LAST_PATTERN ).
Return (string[] type) An array storing the extracted matched strings.
Name extractText
Declaration string[ ] extractText( string text, string query, int searchBegin, int mode )
Description Searches from the specified position onward in a text for parts matching a substring or regular expression, and returns an array containing the extracted matched strings.
If no match is found, the return value is an array with zero elements.
Parameters (string type) text : The target text.
(string type) query : The substring to search for.
(int type) searchBegin : The character index of the search starting position.
(int type) mode : The search mode ( ALL, FIRST, LAST, ALL_PATTERN, FIRST_PATTERN, LAST_PATTERN ).
Return (string[] type) An array storing the extracted matched strings.
Name extractText
Declaration string[ ] extractText( string text, string query, int searchBegin, int searchEnd, int mode )
Description Searches within the specified range of a text for parts matching a substring or regular expression, and returns an array containing the extracted matched strings.
If no match is found, the return value is an array with zero elements.
Parameters (string type) text : The target text.
(string type) query : The substring to search for.
(int type) searchBegin : The character index of the search starting position.
(int type) searchEnd : The character index of the search ending position plus 1 (see cropText).
(int type) mode : The search mode ( ALL, FIRST, LAST, ALL_PATTERN, FIRST_PATTERN, LAST_PATTERN ).
Return (string[] type) An array storing the extracted matched strings.
Name replaceText
Declaration string replaceText( string text, string query, string newPart, int mode )
Description Searches a text for parts matching a substring or regular expression, and returns the text with the matched parts replaced by another string.
Parameters (string type) text : The target text.
(string type) query : The substring to search for.
(string type) newPart : The string to replace the matched parts with.
(int type) mode : The search mode ( ALL, FIRST, LAST, ALL_PATTERN, FIRST_PATTERN, LAST_PATTERN ).
Return (string type) The text with the matched parts replaced.
Name replaceText
Declaration string replaceText( string text, string query, string newPart, int searchBegin, int mode )
Description Searches from the specified position onward in a text for parts matching a substring or regular expression, and returns the text with the matched parts replaced by another string.
Parameters (string type) text : The target text.
(string type) query : The substring to search for.
(string type) newPart : The string to replace the matched parts with.
(int type) searchBegin : The search starting position.
(int type) mode : The search mode ( ALL, FIRST, LAST, ALL_PATTERN, FIRST_PATTERN, LAST_PATTERN ).
Return (string type) The text with the matched parts replaced.
Name replaceText
Declaration string replaceText( string text, string query, string newPart, int searchBegin, int searchEnd, int mode )
Description Searches within the specified range of a text for parts matching a substring or regular expression, and returns the text with the matched parts replaced by another string.
Parameters (string type) text : The target text.
(string type) query : The substring to search for.
(string type) newPart : The string to replace the matched parts with.
(int type) searchBegin : The character index of the search starting position.
(int type) searchEnd : The character index of the search ending position plus 1 (see cropText).
(int type) mode : The search mode ( ALL, FIRST, LAST, ALL_PATTERN, FIRST_PATTERN, LAST_PATTERN ).
Return (string type) The text with the matched parts replaced.
Name splitText
Declaration string[ ] splitText( string text, string query, int mode )
Description Searches a text for parts matching a substring or regular expression, and returns an array containing the original text split at those matched parts.
Parameters (string type) text : The target text.
(string type) query : The substring to search for.
(int type) mode : The search mode ( ALL, FIRST, LAST, ALL_PATTERN, FIRST_PATTERN, LAST_PATTERN ).
Return (string[] type) An array of text pieces split at the matched parts.
Name splitText
Declaration string[ ] splitText( string text, string query, int searchBegin, int mode )
Description Searches from the specified position onward in a text for parts matching a substring or regular expression, and returns an array containing the original text split at those matched parts.
Parameters (string type) text : The target text.
(string type) query : The substring to search for.
(int type) searchBegin : The character index of the search starting position.
(int type) mode : The search mode ( ALL, FIRST, LAST, ALL_PATTERN, FIRST_PATTERN, LAST_PATTERN ).
Return (string[] type) An array of text pieces split at the matched parts.
Name splitText
Declaration string[ ] splitText( string text, string query, int searchBegin, int searchEnd, int mode )
Description Searches within the specified range of a text for parts matching a substring or regular expression, and returns an array containing the original text split at those matched parts.
Parameters (string type) text : The target text.
(string type) query : The substring to search for.
(int type) searchBegin : The character index of the search starting position.
(int type) searchEnd : The character index of the search ending position plus 1 (see cropText).
(int type) mode : The search mode ( ALL, FIRST, LAST, ALL_PATTERN, FIRST_PATTERN, LAST_PATTERN ).
Return (string[] type) An array of text pieces split at the matched parts.
Name split
Declaration string[ ] split( string text, string query )
Description Splits a string at positions matching a specific string, and returns the result as an array.
Currently, the newer splitText function is supported and provides the same or more advanced functionality.For example, splitText(text, query, ALL) gives the same result as this function.
This function is supported for compatibility.
Note that in this function, if query exists exactly at the end of the argument text, it is not regarded as being followed by an empty string, and no empty string is stored in the last element of the returned array.This behavior differs from splitText, but it will not be changed in order to preserve compatibility.
Parameters (string type) text : The target string.
(string type) query : The delimiter string, which is not included in the contents of the resulting string array.
Return (string[] type) An array storing the split results.
Name splitPattern
Declaration string[ ] splitPattern( string text, string query )
Description Splits a string at positions matching a specific regular expression, and returns the result as an array.
Currently, the newer splitText function is supported and provides the same or more advanced functionality.For example, splitText(text, query, ALL_PATTERN) gives the same result as this function.
This function is supported for compatibility.
Note that in this function, if query exists exactly at the end of the argument text, it is not regarded as being followed by an empty string, and no empty string is stored in the last element of the returned array.This behavior differs from splitText, but it will not be changed in order to preserve compatibility.
Parameters (string type) text : The target string.
(string type) query : The delimiter regular expression, which is not included in the contents of the resulting string array.
Return (string[] type) An array storing the split results.
Name replace
Declaration string replace( string text, string oldText, string newText )
Description Returns a string in which all occurrences of a substring contained in a string are replaced with another substring.
Currently, the newer replaceText function is supported and provides the same or more advanced functionality.For example, replaceText(text, query, ALL) gives the same result as this function.
This function is supported for compatibility.
Parameters (string type) text : The target string.
(string type) oldText : The substring before replacement.
(string type) newText : The substring after replacement.
Return (string type) The replacement result.
Name replacePattern
Declaration string replacePattern( string text, string oldText, string newText )
Description Returns a string in which all ranges matching a regular expression in a string are replaced with another substring.
Currently, the newer replaceText function is supported and provides the same or more advanced functionality.For example, replaceText(text, query, ALL_PATTERN) gives the same result as this function.
This function is supported for compatibility.
Parameters (string type) text : The target string.
(string type) oldText : The regular expression for replacement targets.
(string type) newText : The substring after replacement.
Return (string type) The replacement result.
Name replaceFirst
Declaration string replaceFirst( string text, string oldText, string newText )
Description Returns a string in which only the first occurrence of a substring contained in a string is replaced with another substring.
Currently, the newer replaceText function is supported and provides the same or more advanced functionality.For example, replaceText(text, query, FIRST) gives the same result as this function.
This function is supported for compatibility.
Parameters (string type) text : The target string.
(string type) oldText : The substring before replacement.
(string type) newText : The substring after replacement.
Return (string type) The replacement result.
Name replaceFirstPattern
Declaration string replaceFirstPattern( string text, string oldText, string newText )
Description Returns a string in which only the first range matching a regular expression in a string is replaced with another substring.
Currently, the newer replaceText function is supported and provides the same or more advanced functionality.For example, replaceText(text, query, FIRST_PATTERN) gives the same result as this function.
This function is supported for compatibility.
Parameters (string type) text : The target string.
(string type) oldText : The regular expression for replacement targets.
(string type) newText : The substring after replacement.
Return (string type) The replacement result.
Name replaceFirst
Declaration string replaceFirst( string text, string oldText, string newText, int start )
Description Returns a string in which a substring is replaced with another substring.If multiple matching substrings exist, only the first one at or after the index specified by the argument start is replaced.
Currently, the newer replaceText function is supported and provides the same or more advanced functionality.For example, replaceText(text, query, start, FIRST) gives the same result as this function.
This function is supported for compatibility.
Parameters (string type) text : The target string.
(string type) oldText : The substring before replacement.
(string type) newText : The substring after replacement.
(int type) start : The start index of the search range.
Return (string type) The replacement result.
Name replaceFirstPattern
Declaration string replaceFirstPattern( string text, string oldText, string newText, int start )
Description Returns a string in which a range matching a regular expression is replaced with another substring.If multiple matching ranges exist, only the first one at or after the index specified by the argument start is replaced.
Currently, the newer replaceText function is supported and provides the same or more advanced functionality.For example, replaceText(text, query, start, FIRST_PATTERN) gives the same result as this function.
This function is supported for compatibility.
Parameters (string type) text : The target string.
(string type) oldText : The regular expression for replacement targets.
(string type) newText : The substring after replacement.
(int type) start : The start index of the search range.
Return (string type) The replacement result.
Name substring
Declaration string substring( string text, int start, int end )
Description Returns the substring in the specified index range within a string.
Currently, the newer cropText function is supported and provides the same functionality.For example, cropText(text, start, end) gives the same result as this function.
This function is supported for compatibility.
Parameters (string type) text : The target string.
(int type) start : The start index of the range.
(int type) end : The end index of the range plus 1.
Return (string type) The substring.
Name lengthOf
Declaration int lengthOf( string text )
Description Returns the number of characters in a string.
Currently, the newer countText function is supported and provides the same functionality.For example, countText(text) gives the same result as this function.
This function is supported for compatibility.
Parameters (string type) text : The target string.
Return (int type) The number of characters.
Name startsWith
Declaration bool startsWith( string text, string word )
Description Determines whether a string starts with the specified substring.
Currently, the newer checkText function is supported and provides the same functionality.For example, checkText(text, word, START) gives the same result as this function.
This function is supported for compatibility.
Parameters (string type) text : The target string.
(string type) word : The substring.
Return (bool type) Returns true if the string starts with the specified substring, or false otherwise.
Name endsWith
Declaration bool endsWith( string text, string word )
Description Determines whether a string ends with the specified substring.
Currently, the newer checkText function is supported and provides the same functionality.For example, checkText(text, word, END) gives the same result as this function.
This function is supported for compatibility.
Parameters (string type) text : The target string.
(string type) word : The substring.
Return (bool type) Returns true if the string ends with the specified substring, or false otherwise.
Name match
Declaration string match( string text, string pattern )
Description Use of this API is not recommended.
Currently, the newer extractText function is supported and provides the same functionality.For example, extractText(text, pattern, FIRST_PATTERN) gives the same result as this function.
This function is supported for compatibility.
Return (string type)
Name match
Declaration string match( string text, string pattern, int start )
Description Use of this API is not recommended.
Currently, the newer extractText function is supported and provides the same functionality.For example, extractText(text, pattern, start, FIRST_PATTERN) gives the same result as this function.
This function is supported for compatibility.
Return (string type)
Name matchFull
Declaration bool matchFull( string text, string pattern )
Description Determines whether an entire string matches a regular expression.
Currently, the newer checkText function is supported and provides the same functionality.For example, checkText(text, word, FULL_PATTERN) gives the same result as this function.
This function is supported for compatibility.
Parameters (string type) text : The target string.
(string type) pattern : The regular expression.
Return (bool type) Returns true if the entire string matches the regular expression, or false otherwise.
Name matchFirst
Declaration string matchFirst( string text, string pattern )
Description Extracts and returns the first part matching a regular expression from a string.
Currently, the newer extractText function is supported and provides the same functionality.For example, extractText(text, pattern, FIRST_PATTERN) gives the same result as this function.
This function is supported for compatibility.
Parameters (string type) text : The target string.
(string type) pattern : The regular expression.
Return (string type) The substring matching the regular expression.
Name matchFirst
Declaration string matchFirst( string text, string pattern, int start )
Description Extracts and returns a part matching a regular expression from a string.If multiple matching parts exist, only the first one at or after the index specified by the argument start is selected.
Currently, the newer extractText function is supported and provides the same functionality.For example, extractText(text, pattern, start, FIRST_PATTERN) gives the same result as this function.
This function is supported for compatibility.
Parameters (string type) text : The target string.
(string type) pattern : The regular expression.
(int type) start : The start index of the search range.
Return (string type) The substring matching the regular expression.
Name matchLast
Declaration string matchLast( string text, string pattern )
Description Extracts and returns the last part matching a regular expression from a string.
Currently, the newer extractText function is supported and provides the same functionality.For example, extractText(text, pattern, LAST_PATTERN) gives the same result as this function.
This function is supported for compatibility.
Parameters (string type) text : The target string.
(string type) pattern : The regular expression.
Return (string type) The substring matching the regular expression.
Name matchLast
Declaration string matchLast( string text, string pattern, int end )
Description Extracts and returns a part matching a regular expression from a string.If multiple matching parts exist, only the last one before the position of the index specified by the argument end is selected.
Currently, the newer extractText function is supported and provides the same functionality.For example, extractText(text, pattern, 0, end, LAST_PATTERN) gives the same result as this function.
This function is supported for compatibility.
Parameters (string type) text : The target string.
(string type) pattern : The regular expression.
(int type) end : The end index of the search range.
Return (string type) The substring matching the regular expression.
Name indexOf
Declaration int indexOf( string text, string word )
Description Obtains the position of the specified substring in a string.If multiple occurrences exist, the first one is selected. If none exists, -1 is returned.
Currently, the newer findText function is supported and provides the same functionality.For example, findText(text, word, FIRST) gives the same result as this function.(However, if there is no match, an array with zero elements is returned.)
To determine whether a string contains a substring, you can use something like 0 < countText(text, word, ALL).
This function is supported for compatibility.
Parameters (string type) text : The target string.
(string type) word : The substring.
Return (int type) The position index of the substring.
Name indexOf
Declaration int indexOf( string text, string word, int start )
Description Obtains the position of the specified substring in a string.If multiple occurrences exist, the first one at or after the index specified by the argument start is selected. If none exists, -1 is returned.
Currently, the newer findText function is supported and provides the same functionality.For example, findText(text, word, start, FIRST) gives the same result as this function.(However, if there is no match, an array with zero elements is returned.)
To determine whether a substring exists at or after the specified position in a string, you can use something like 0 < countText(text, word, start, ALL).
This function is supported for compatibility.
Parameters (string type) text : The target string.
(string type) word : The substring.
(int type) start : The start index of the search range.
Return (int type) The position index of the substring.
Name indexOfPattern
Declaration string indexOfPattern( string text, string word )
Description Obtains the position of the specified regular expression match in a string.If multiple matches exist, the first one is selected. If none exists, -1 is returned.
Currently, the newer findText function is supported and provides the same functionality.For example, findText(text, word, FIRST_PATTERN) gives the same result as this function.(However, if there is no match, an array with zero elements is returned.)
This function is supported for compatibility.
Parameters (string type) text : The target string.
(string type) word : The regular expression.
Return (string type) The position index of the matched part.
Name indexOfPattern
Declaration string indexOfPattern( string text, string word, int start )
Description Obtains the position of the specified regular expression match in a string.If multiple matches exist, the first one at or after the index specified by the argument start is selected. If none exists, -1 is returned.
Currently, the newer findText function is supported and provides the same functionality.For example, findText(text, word, start, FIRST_PATTERN) gives the same result as this function.(However, if there is no match, an array with zero elements is returned.)
This function is supported for compatibility.
Parameters (string type) text : The target string.
(string type) word : The regular expression.
(int type) start : The start index of the search range.
Return (string type) The position index of the matched part.
Name lastIndexOf
Declaration int lastIndexOf( string text, string word )
Description Obtains the position of the specified substring in a string.If multiple occurrences exist, the last one is selected. If none exists, -1 is returned.
Currently, the newer findText function is supported and provides the same functionality.For example, findText(text, word, LAST) gives the same result as this function.(However, if there is no match, an array with zero elements is returned.)
This function is supported for compatibility.
Parameters (string type) text : The target string.
(string type) word : The substring.
Return (int type) The position index of the substring.
Name lastIndexOf
Declaration int lastIndexOf( string text, string word, int end )
Description Obtains the position of the specified substring in a string.If multiple occurrences exist, the last one before or at the index specified by the argument end is selected. If none exists, -1 is returned.
Currently, the newer findText function is supported and provides the same functionality.For example, findText(text, word, 0, end, LAST) gives the same result as this function.(However, if there is no match, an array with zero elements is returned.)
This function is supported for compatibility.
Parameters (string type) text : The target string.
(string type) word : The substring.
(int type) end : The end index of the search range.
Return (int type) The position index of the substring.
Name lastIndexOfPattern
Declaration string lastIndexOfPattern( string text, string word )
Description Obtains the position of the specified regular expression match in a string.If multiple matches exist, the last one is selected. If none exists, -1 is returned.
Currently, the newer findText function is supported and provides the same functionality.For example, findText(text, word, LAST_PATTERN) gives the same result as this function.(However, if there is no match, an array with zero elements is returned.)
This function is supported for compatibility.
Parameters (string type) text : The target string.
(string type) word : The regular expression.
Return (string type) The position index of the matched part.
Name lastIndexOfPattern
Declaration string lastIndexOfPattern( string text, string word, int end )
Description Obtains the position of the specified regular expression match in a string.If multiple matches exist, the last one before or at the index specified by the argument end is selected. If none exists, -1 is returned.
Currently, the newer findText function is supported and provides the same functionality.For example, findText(text, word, 0, end, LAST_PATTERN) gives the same result as this function.(However, if there is no match, an array with zero elements is returned.)
This function is supported for compatibility.
Parameters (string type) text : The target string.
(string type) word : The regular expression.
(int type) end : The end index of the search range.
Return (string type) The position index of the matched part.
Name charAt
Declaration string charAt( string text, int index )
Description Returns the character at the specified index in a string.
Currently, the newer atText function is supported and provides the same functionality.For example, atText(text, index) gives the same result as this function.
This function is supported for compatibility.
Parameters (string type) text : The target string.
(int type) index : The character index.
Return (string type) The character.
Name tokenize
Declaration string[ ] tokenize( string text )
Description Splits a string into tokens separated by spaces, tabs, or line breaks, and returns them as an array.
Parameters (string type) text : The target string.
Return (string[] type) The token array.