67 vector<tString> mSeparators;
68 vector<tString> mTokenizer;
96 static inline SP::CORE_String
New() {
169 int n=separator.length();
170 mSeparators.resize(n);
171 for (
int i=0;i<n;i++) {
172 mSeparators[i]=separator.substr(i,1);
183 return mTokenizer.size();
188 return mTokenizer.size();
198 return (mTokenIndex<((
int)mTokenizer.size()));
204 return mTokenizer[mTokenIndex++];
210 return mTokenizer[index];
261 for (
int i=n;i<len;i++) ret+=
" ";
269 std::transform(s.begin(), s.end(),
270 s.begin(), ::toupper);
290 std::transform(s.begin(), s.end(),
291 s.begin(), ::tolower);
366 if (c)
return "true";
377 if (c.compare(
"true")==0)
return true;
378 else if (c.compare(
"1")==0)
return true;
390 char *cs=
new char[2];
464 if (str.compare(
"true")==0) c=
true;
465 else if (str.compare(
"false")==0) c=
false;
502 return mString.find(v);
508 return mString.rfind(v);
514 return mString.rfind(v);
526 const tString::size_type& fromIndex)
const {
527 return mString.find(v,fromIndex);
537 const int& nLines,
tBoolean& isTruncated);
540 inline void remove(
const tString::size_type& from,
541 const tString::size_type& to) {
542 mString.erase(from,to-from+1);
546 inline void remove(
const tString::size_type& index) {
547 mString=mString.erase(index,1);
555 static void truncate(
tString& text,
const int &nLines,
const int& nCharsByLine);
561 const tString::size_type& from,
562 const tString::size_type& to) {
563 return str.substr(from,to-from);
569 const tString::size_type& to)
const {
570 return mString.substr(from,to-from);
575 return mString.substr(from);
581 inline char charAt(
const int& index)
const {
582 return mString[index];
587 return mString.length();
620 return ( ((v>=
'a') && (v<=
'z')) ||
621 ((v>=
'A') && (v<=
'Z'))
627 return ((v>=
'0') && (v<=
'9'));
641 #endif // end of ifndef
this class describes a string
Definition: CORE_String.h:59
static tString toString(const unsigned long &c)
return the string representation of c
Definition: CORE_String.h:350
void begin()
Definition: CORE_String.h:191
static int getOccurencesNumber(const tString &str, const tString &occ)
get the number of occurence of the string
Definition: CORE_String.cpp:129
tBoolean hasNextToken() const
return true if there is another token
Definition: CORE_String.h:197
static tString boolean2String(const tBoolean &c)
return the string representation true or false of boolean c
Definition: CORE_String.h:365
static void parse(const tString &str, float &c)
parse float c in str
Definition: CORE_String.h:475
void replaceAll(const tString &strToReplace, const tString &str)
replace all instances of strToReplace by str
Definition: CORE_String.h:215
tString::size_type lastIndexOf(const tString &v) const
return the last index of v fin this->mString
Definition: CORE_String.h:507
static tString toString(tComplex c)
return the string representation of complex c
Definition: CORE_String.h:399
static tComplex parseComplex(tString str)
return the complex associated to the string
Definition: CORE_Complex.cpp:35
static tString toString(const tBoolean &c)
return the string representation of boolean c
Definition: CORE_String.h:360
static void parse(const tString &str, tString &c)
parse tString c in str
Definition: CORE_String.h:490
tString toString() const
return the string associated to the string
Definition: CORE_String.h:150
static tString toLower(const tString &str)
turn the string to upper case
Definition: CORE_String.h:300
static tString toString(tCharacter c)
return the string representation of char c
Definition: CORE_String.h:388
static tString toUpper(const tString &str)
turn the string to upper case
Definition: CORE_String.h:281
static long int parseInt(tString str)
return the integer associated to the string
Definition: CORE_Integer.cpp:120
static void truncate(tString &text, const int &nLines, const int &nCharsByLine)
truncate the message with nLines of nChars
Definition: CORE_String.cpp:243
#define tCharacter
Definition: types.h:40
static tString toString(const int &c)
return the string representation of int c
Definition: CORE_String.h:330
static void parse(const tString &str, unsigned long long &c)
parse unsigned long long c in str
Definition: CORE_String.h:458
static tBoolean string2Boolean(const tString &c)
return the booleazn corresponding to string
Definition: CORE_String.h:376
int length() const
get the size of the size
Definition: CORE_String.h:586
#define tComplex
Definition: types.h:37
static void parse(const tString &str, unsigned short int &c)
parse short c in str
Definition: CORE_String.h:428
void toLower()
turn the string to lower case
Definition: CORE_String.h:295
void trim()
trim
Definition: CORE_String.h:605
void replaceFirst(const tString &strToReplace, const tString &str)
replace first instance of strToReplace by str
Definition: CORE_String.h:221
static tString toString(const float &c)
return the string representation of float c
Definition: CORE_String.h:315
#define tBoolean
Definition: types.h:35
static tString toString(const long long &c)
return the string representation of long long c
Definition: CORE_String.h:340
static tString keepOnlyFirstLines(const tString &str, const int &nLines, tBoolean &isTruncated)
keep only the first lines of parameter str
Definition: CORE_String.cpp:223
static void parse(const tString &str, char &c)
parse char c in str
Definition: CORE_String.h:470
CORE_String()
create a string
Definition: CORE_String.cpp:12
static tString toString(const tFlag &c)
return the string representation of short c
Definition: CORE_String.h:310
char * toCharArray() const
turn the string into char array
Definition: CORE_String.h:157
tString getToken(const int &index)
get the token at index
Definition: CORE_String.h:209
void toUpper()
turn the string to upper case
Definition: CORE_String.h:276
static tString substring(const tString &str, const tString::size_type &from, const tString::size_type &to)
return the string between from & to indices from index is included, to is not
Definition: CORE_String.h:560
static void parse(const tString &str, unsigned char &c)
parse unsigned char c in str
Definition: CORE_String.h:418
~CORE_String()
deleter
Definition: CORE_String.cpp:19
tString nextToken()
return the next token
Definition: CORE_String.h:203
static void parse(const tString &str, long long &c)
parse long long c in str
Definition: CORE_String.h:443
void replaceLast(const tString &strToReplace, const tString &str)
replace last instance of strToReplace by str
Definition: CORE_String.h:227
static void parse(const tString &str, double &c)
parse double c in str
Definition: CORE_String.h:480
static tString toString(const unsigned long long &c)
return the string representation of unsigned long long c
Definition: CORE_String.h:355
static void parse(const tString &str, bool &c)
parse boolean c in str
Definition: CORE_String.h:463
static void parse(const tString &str, tComplex &c)
parse tComplex c in str
Definition: CORE_String.h:495
const char & operator[](int i) const
get the i-th element Assert in (i>-1) Assert in (i
Definition: CORE_String.h:115
int getTokensCount() const
get the number of tokens
Definition: CORE_String.h:182
#define SP_OBJECT(X)
Definition: CORE_Pointers.h:176
static SP::CORE_String New(const tString &str)
build an integer object
Definition: CORE_String.h:103
static tString toString(const long &c)
return the string representation of long c
Definition: CORE_String.h:335
tString::size_type indexOf(const tString &v) const
return the first index of v fin this->mString
Definition: CORE_String.h:501
static void parse(const tString &str, short int &c)
parse short c in str
Definition: CORE_String.h:423
static tString toString(const int &n, const long double *c)
return the string representation of long double c
Definition: CORE_String.h:409
void tokenize(const tString &separator)
tokenize the string with the separator
Definition: CORE_String.h:168
static tReal readReal(const tString &v)
read only real characters if not a real return 0
Definition: CORE_String.cpp:178
char & operator[](int i)
get the i-th element Assert in (i>-1) Assert in (i
Definition: CORE_String.h:123
static void toUpper(tString &s)
to upper
Definition: CORE_String.h:268
static int readInteger(const tString &v)
read only integer characters
Definition: CORE_String.cpp:144
void append(const tString &v)
append the string v to the string
Definition: CORE_String.h:591
static tString booleanToString(const tBoolean &c)
return the string representation true or false of boolean c
Definition: CORE_String.h:371
static void parse(const tString &str, unsigned int &c)
parse unsigned int c in str
Definition: CORE_String.h:448
tString toString() const
return the string associated to the integer
Definition: CORE_Integer.h:142
void setString(const char *str)
set the integer to i
Definition: CORE_String.h:132
void setString(const tString &str)
set the integer to i
Definition: CORE_String.h:129
abstract base class for most classes.
Definition: CORE_Object.h:30
static void parse(const tString &str, int &c)
parse int c in str
Definition: CORE_String.h:433
static tString toString(const double &c)
return the string representation of double c
Definition: CORE_String.h:320
#define tString
Definition: types.h:36
tString toString() const
return the string associated to the real
Definition: CORE_Real.h:89
void append(const char &v)
append the char v to the string
Definition: CORE_String.h:596
static long double parseReal(const tString &str)
return the real associated to the string
Definition: CORE_Real.cpp:78
static void parse(const tString &str, long double &c)
parse long double c in str
Definition: CORE_String.h:485
tString substring(const tString::size_type &from) const
return the string from index
Definition: CORE_String.h:574
static tBoolean stringToBoolean(const tString &c)
return the booleazn corresponding to string
Definition: CORE_String.h:383
static tString toString(const unsigned int &c)
return the string representation of unsigned int c
Definition: CORE_String.h:345
static void parse(const tString &str, long &c)
parse long c in str
Definition: CORE_String.h:438
tString substring(const tString::size_type &from, const tString::size_type &to) const
return the string between from & to indices from index is included, to is not
Definition: CORE_String.h:568
static SP::CORE_String New()
create a class String
Definition: CORE_String.h:96
tString::size_type indexOf(const tString &v, const tString::size_type &fromIndex) const
return the index of char v in this->mString from fromIndex index
Definition: CORE_String.h:525
tString getString() const
get the string
Definition: CORE_String.h:143
static void toLower(tString &s)
to lower
Definition: CORE_String.h:289
tString toString() const
return the string associated to the real
Definition: CORE_Complex.h:91
static tString toString(const long double &c)
return the string representation of long double c
Definition: CORE_String.h:325
static tString toString(tString c)
return the string representation of string c
Definition: CORE_String.h:404
static tString toString(const tString &str, const int &len)
return the string associated to the string
Definition: CORE_String.h:258
static tString::size_type getLastIndexOf(const tString &str, const tString &v)
return the last index of v fin this->mString
Definition: CORE_String.h:519
static char * stringToCharArray(const tString &str)
turn the string into char array
Definition: CORE_String.cpp:23
static void removeAll(tString &inOutStr, const tString &strToRemove)
remove the char at index
Definition: CORE_String.cpp:86
static tBoolean isDigit(const char &v)
return if the char is a digit
Definition: CORE_String.h:626
static void parse(const tString &str, unsigned long &c)
parse unsigned long c in str
Definition: CORE_String.h:453
#define tReal
Definition: types.h:18
void tokenize()
tokenize the string
Definition: CORE_String.cpp:31
int getTokensNumber() const
get the number of tokens
Definition: CORE_String.h:187
char charAt(const int &index) const
return the char at index
Definition: CORE_String.h:581
tString::size_type getLastIndexOf(const tString &v) const
return the last index of v fin this->mString
Definition: CORE_String.h:513
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:106
#define tFlag
Definition: types.h:14
static tBoolean isLetter(const char &v)
return if the char is a letter
Definition: CORE_String.h:619