![]() | Macro Programming | ![]() |
#include <string.h>
Public Member Functions | |
bool | contains (string str) |
contain a string | |
int | indexOf (string str, int index) |
index of | |
int | lastIndexOf (string str, int index) |
index of | |
string | left (int i) |
left | |
int | length () |
length | |
string | mid (int i, int k=-1) |
mid of string | |
string | setDate (string format) |
set date | |
string | setDateTime (string format) |
set date and time | |
string | setNum (double d, int k) |
set number | |
string | setNum (int i) |
set number | |
string | setTime (string format) |
set time | |
int | size () |
size | |
void | toDouble () |
convert to double | |
void | toInt () |
convert to integer |
Conversion from/to int/double is done implecit.
bool string::contains | ( | string | str | ) |
contain a string
int string::indexOf | ( | string | str, | |
int | index | |||
) |
index of
Returns the index position of the first occurrence of the string str in this string, searching forward from index position from. Returns -1 if str is not found.
int string::lastIndexOf | ( | string | str, | |
int | index | |||
) |
index of
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.
string string::left | ( | int | i | ) |
left
int string::length | ( | ) |
length
string string::mid | ( | int | i, | |
int | k = -1 | |||
) |
mid of string
set date
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.
set date and time
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. 'QtMonday' to 'QtSunday'). |
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 whithout a leading zero (0 to 59) |
ss | the second whith 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". |
string string::setNum | ( | double | d, | |
int | k | |||
) |
set number
Set the string to the number d with precision of k
string string::setNum | ( | int | i | ) |
set number
Set the string to the number i
set time
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.
int string::size | ( | ) |
size
void string::toDouble | ( | ) |
convert to double
The string is converted to a double.
void string::toInt | ( | ) |
convert to integer
The string is converted to a integer.