The string class provides a Unicode character string. More...
string( ) | |
string(string item) | |
bool | contains(string item) |
int | indexOf(string str, int index) |
void | jsonInsert(string key, string value) |
stringList | jsonKeys(string key) |
string | jsonValue(string key) |
int | lastIndexOf(string str, int index) |
string | left(int left) |
int | length() |
string | mid(int position, int length=-1) |
string | parameter(string str) |
string | remove(string str) |
string | removeNonAscii() |
string | replace(string macht,string with) |
string | right(int right) |
string | setDate(string format="") |
string | setDateTime(string format="") |
string | setEng(double value) |
string | setHex(int hex-number) |
string | setNum(double value, int precision) |
string | setNum(int number) |
string | setTime(string format="") |
int | size() |
stringList | split(string s) |
double | toDouble() |
double | toDoubleFromEng() |
int | toInt() |
string | toLower() |
string | toUpper() |
string | trimmed() |
The string class provides a Unicode character string. In scripting interfaces this class will be mapped to build in string types.
Creates a new empty string-
Creates a string containing a copy of item.
Returns: true, if the string contains the string item. Otherwise false is returned.
Returns: Returns the index position of the first occurrence of the string str in this string, searching forward from index position. Returns -1 if str is not found.
This method will parse the string as a json (java script object notation) and set the key value pair to it. (introduced with release 202003021)
This method will parse the string as a json (java script object notation) and return any key of the spezified subobject. (introduced with release 20200428)
This method will parse the string as a json (java script object notation) and return the value of the key. An empty string is return in case the json does not contain the key. (introduced with release 202003021)
Returns: Returns the index position of the last occurrence of the string str in this string, searching backward from index position from. If from is -1, the search starts at the last character; if from is -2, at the next to last character and so on. Returns -1 ,if str is not found.
Returns: the left chars of the string
Returns: length of the string, identical with size
Returns: length a path of the string starting at position with the length. The rest of the string starting at position is returned if length is -1 or missing.
Returns: the parameter str. Example:
string s="type=2 width=4 length=6";
s=s.parameter("width");
// s="4";
Remove all str from the string. The removement is case sensitive.
Removes all non ascii characters from the string (introduced 20201011).
All existing strings match is replaced with with. The replacement is case sensitive.
Returns: the right chars of the string (introduced with release 20180610)
Set the string to the current date. With the string format the format can be set. Without the string the date is set to local setup. setDateTime for possible formats
Set the string to the current date and time. With the string format the format can be set. Without the string the date is set to local setup.
The format string may contain:
Expression | Output |
---|---|
d | the day as number without a leading zero (1 to 31) |
dd | the day as number with a leading zero (01 to 31) |
ddd | the abbreviated localized day name (e.g. 'Mon' to 'Sun'). |
dddd | the long localized day name (e.g. 'Qt::Monday' to 'Qt::Sunday'). |
M | the month as number without a leading zero (1-12) |
MM | the month as number with a leading zero (01-12) |
MMM | the abbreviated localized month name (e.g. 'Jan' to 'Dec'). |
MMMM | the long localized month name (e.g. 'January' to 'December'). |
yy | the year as two digit number (00-99) |
yyyy | the year as four digit number (1752-8000) |
h | the hour without a leading zero (0 to 23 or 1 to 12 if AM/PM display) |
hh | the hour with a leading zero (00 to 23 or 01 to 12 if AM/PM display) |
m | the minute without a leading zero (0 to 59) |
mm | the minute with a leading zero (00 to 59) |
s | the second without a leading zero (0 to 59) |
ss | the second with a leading zero (00 to 59) |
z | the milliseconds without leading zeroes (0 to 999) |
zzz | the milliseconds with leading zeroes (000 to 999) |
AP | use AM/PM display. AP will be replaced by either "AM" or "PM". |
ap | use am/pm display. ap will be replaced by either "am" or "pm". |
Set the string to the number dalue in engineering notation like 10k.
Set the string to the hex-number as hexadecimal value. (introduced with version 20180408)
Set the string to the number value with precision digits.
Set the string to the number.
Set the string to the current time. With the string format the format can be set. Without the string the date is set to local setup. setDateTime for possible formats
Returns: length of the string (same as length)
Returns: The string is spited into a stringList with s as separator char.
Returns: The string is converted to a double.
Returns: The string is converted to a double respecting engineering notation like 10.6k, 7.3n, etc.
Returns: The string is converted to a integer.
Returns: an lowercase copy of the string. (introduced with release 20180614)
Returns: an uppercase copy of the string. (introduced with release 20180614)
Returns: A string that has whitespace removed from the start and the end.