Enfusion Script API
|
Public Member Functions | |
proto external int | ToAscii (int index=0) |
Gets the ASCII code of a character in the string. | |
proto external float | ToFloat (float default=0.0, int offset=0, out int parsed=-1) |
Parses a float from a string. | |
proto external int | ToInt (int default=0, int offset=0, out int parsed=-1) |
Parses an integer from a string. | |
proto external vector | ToVector () |
Returns a vector from a string. | |
proto external string | Substring (int start, int len) |
Substring of str from start position len number of characters. | |
proto external string | Trim () |
Returns trimmed string with removed leading and trailing whitespaces. | |
proto external int | TrimInPlace () |
Removes leading and trailing whitespaces in string. | |
proto external int | Length () |
Returns length of string. | |
proto external bool | IsEmpty () |
Determines if string is empty. | |
proto external int | Hash () |
Returns hash of string. | |
proto external int | IndexOf (string sample) |
Finds 'sample' in 'str'. | |
proto external int | LastIndexOf (string sample) |
Finds last 'sample' in 'str'. | |
proto external int | IndexOfFrom (int start, string sample) |
Finds 'sample' in 'str' from 'start' position. | |
proto external bool | Contains (string sample) |
Retunrs true if sample is substring of string. | |
proto external bool | ContainsAt (string sample, int pos) |
Checks whether the string contains a given substring at a given position. | |
proto external bool | StartsWith (string sample) |
Checks whether the string begins with a given substring. | |
proto external bool | EndsWith (string sample) |
Retunrs true if string ends with sample, otherwise return false. | |
proto external int | Compare (string sample, bool caseSensitive=true) |
Compares with sample and returns an integer less than, equal to, or greater than zero if string is less than, equal to, or greater than sample. | |
proto external int | Replace (string sample, string replace) |
Replace all occurrances of 'sample' in 'str' by 'replace'. | |
proto external int | ToLower () |
Changes string to lowercase. | |
proto external int | ToUpper () |
Changes string to uppercase. | |
proto external void | Split (string delimiter, notnull out array< string > outTokens, bool removeEmptyEntries) |
Splits string into array of strings separated by delimiter . | |
proto external string | Get (int index) |
Gets n-th character from string. | |
proto external bool | IsDigitAt (int index) |
Checks whether a character at a given position is a digit. | |
proto external bool | IsSpaceAt (int index) |
Checks whether a character at a given position is a whitespace. | |
proto external TypeName | ToType () |
Returns internal type representation. | |
Static Public Member Functions | |
static proto string | Format (string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL) |
Builds a string using given format and arguments. | |
static proto string | ToString (void var, bool type=false, bool name=false, bool quotes=true) |
Static Public Attributes | |
static const string | Empty |
Compares with sample and returns an integer less than, equal to, or greater than zero if string is less than, equal to, or greater than sample.
sample | string to campare with |
bool
less than, equal to, or greater than zero if string is less than, equal to, or greater than sample Retunrs true if sample is substring of string.
sample | string Finding string expression |
bool
true if sample is substring of string Checks whether the string contains a given substring at a given position.
sample | The substring to test |
pos | Position to test for the substring (index of the string's character) |
Retunrs true if string ends with sample, otherwise return false.
sample | string Finding string expression |
bool
true if string ends with sample
|
static |
Builds a string using given format and arguments.
(Maximum output string size is limited to 8191 characters)
fmt | Formatting string - any string with special tokens %1 .. %9. |
param1 | Replaces the "%1" token in the formatting string in the result |
param2 | Replaces the "%2" token |
Gets n-th character from string.
index | character index |
string
character on index-th position in string proto external int string.Hash | ( | ) |
Returns hash of string.
Finds 'sample' in 'str'.
Returns -1 when not found
sample | string Finding string |
int
- Returns position where sample
starts, or -1 when sample
not found Finds 'sample' in 'str' from 'start' position.
Returns -1 when not found
start | int Start from position |
sample | string Finding string expression |
int
- Length of string s
Checks whether a character at a given position is a digit.
index | position of the character in the string |
proto external bool string.IsEmpty | ( | ) |
Determines if string is empty.
Checks whether a character at a given position is a whitespace.
A whitespace may be e.g. Space (0x20 " "), Tab (0x09 "\t"), New Line (0x09 "\r", 0x0a "\n") etc.
index | position of the character in the string |
proto external int string.Length | ( | ) |
Returns length of string.
Replace all occurrances of 'sample' in 'str' by 'replace'.
sample | string to search in str |
replace | string which replace sample in str |
int
- number of occurrances of 'sample' in 'str' proto external void string.Split | ( | string | delimiter, |
notnull out array< string > | outTokens, | ||
bool | removeEmptyEntries | ||
) |
Splits string into array of strings separated by delimiter
.
delimiter | Strings separator | |
[out] | outTokens | Array with strings |
removeEmptyEntries | If true removes empty strings from outTokens array array<string> strs = {};
string line = "The;quick;brown;fox;jumps;over;the;;dog;";
{
}
>> 'The'
>> 'quick'
>> 'brown'
>> 'fox'
>> 'jumps'
>> 'over'
>> 'the'
>> 'dog'
Definition: Types.c:150 proto T Get(int n) proto external void Split(string delimiter, notnull out array< string > outTokens, bool removeEmptyEntries) Splits string into array of strings separated by delimiter. |
Checks whether the string begins with a given substring.
sample | The substring to test |
Substring of str
from start
position len
number of characters.
(Maximum output string size is limited to 8191 characters)
start | Position in str |
len | Count of characters |
Gets the ASCII code of a character in the string.
index | Index of the character, 0 by default. |
Parses a float from a string.
Any whitespaces at the beginning in front of a number in the string will be skipped.
default | Will be returned when the parsing fails (e.g. there's no number to parse) |
offset | Number of characters in the string to skip |
parsed | Out param - number of characters read |
Parses an integer from a string.
Any whitespaces at the beginning in front of a number in the string will be skipped.
default | Will be returned when the parsing fails (e.g. there's no number to parse) |
offset | Number of characters in the string to skip |
parsed | Out param - number of characters read |
proto external int string.ToLower | ( | ) |
Changes string to lowercase.
Returns length. Works with just ASCII characters
|
static |
proto external TypeName string.ToType | ( | ) |
Returns internal type representation.
Can be used in runtime, or cached in variables and used for faster inheritance checking
typename
Type of class proto external int string.ToUpper | ( | ) |
Changes string to uppercase.
Returns length. Works with just ASCII characters
proto external vector string.ToVector | ( | ) |
Returns a vector from a string.
vector
Converted s as vector proto external string string.Trim | ( | ) |
Returns trimmed string with removed leading and trailing whitespaces.
(Maximum output string size is limited to 8191 characters)
string
- Trimmed string proto external int string.TrimInPlace | ( | ) |
Removes leading and trailing whitespaces in string.
Returns length
int
- Count of chars
|
static |