96 static inline SP::CORE_String
New() {
244 tUIndex i,n=separator.length();
245 mSeparators.resize(n);
247 mSeparators[i]=separator.substr(i,1);
258 return mTokenizer.size();
263 return mTokenizer.size();
267 mTokenIndex=mTokenizer.begin();
273 return (mTokenIndex!=mTokenizer.end());
287 return mTokenizer[index];
338 for (i=n;i<len;i++) ret+=
" ";
346 std::transform(s.begin(), s.end(),
347 s.begin(), ::toupper);
360 std::transform(s.begin(), s.end(),
361 s.begin(), ::tolower);
461 return (c ?
"true" :
"false");
471 if (c.compare(
"true")==0)
return true;
472 else if (c.compare(
"1")==0)
return true;
550 if (str.compare(
"true")==0) c=
true;
551 else if (str.compare(
"false")==0) c=
false;
589 return mString.find(v);
596 return mString.rfind(v);
603 return mString.rfind(v);
617 const tUIndex& fromIndex)
const {
618 return mString.find(v,fromIndex);
635 mString.erase(from,to-from+1);
640 mString=mString.erase(index,1);
656 return str.substr(from,to-from);
663 return mString.substr(from,to-from);
668 return mString.substr(from);
675 return (*
this)[index];
680 return mString.length();
690 mString.append(&v,1);
713 return ( ((v>=
'a') && (v<=
'z')) ||
714 ((v>=
'A') && (v<=
'Z'))
720 return (((v>=
'0') && (v<=
'9')) || (v==
'-') || (v==
'+'));
739 #endif // end of ifndef this class describes a string
Definition: CORE_String.h:59
CORE_String & operator+=(const CORE_String &s)
append the s String to the end
Definition: CORE_String.h:157
static void parse(const tString &str, tLDouble &c)
parse long double c in str
Definition: CORE_String.h:571
void begin()
Definition: CORE_String.h:266
static tString boolean2String(const tBoolean &c)
return the string representation true or false of boolean c
Definition: CORE_String.h:460
static tString substring(const tString &str, const tUIndex &from, const tUIndex &to)
return the string between from & to indices from index is included, to is not
Definition: CORE_String.h:653
static tString toString(const tString &c)
return the string representation of string c
Definition: CORE_String.h:488
CORE_String & operator=(const tString &s)
set the string to s
Definition: CORE_String.h:135
void replaceAll(const tString &strToReplace, const tString &str)
replace all instances of strToReplace by str
Definition: CORE_String.h:292
static tUIndex getLastIndexOf(const tString &str, const tString &v)
return the last index of v fin this->mString if not exists return CORE_Object::getMaxUIndex(); ...
Definition: CORE_String.h:609
static tLLInt parseInt(const tString &str)
return the integer associated to the string
Definition: CORE_Integer.cpp:102
#define tLDouble
Definition: types.h:54
static tString toString(const tBoolean &c)
return the string representation of char
Definition: CORE_String.h:379
static void parse(const tString &str, tString &c)
parse tString c in str
Definition: CORE_String.h:576
#define tDouble
Definition: types.h:52
static tString toString(const tLDouble *c, const tUInteger &n)
return the string representation of long double c
Definition: CORE_String.h:493
static void parse(const tString &str, tInt &c)
parse int c in str
Definition: CORE_String.h:519
static void parse(const tString &str, tULInt &c)
parse unsigned long c in str
Definition: CORE_String.h:539
static tString toString(const tDouble &c)
return the string representation of double c
Definition: CORE_String.h:449
static tComplex parseComplex(const tString &str)
return the complex associated to the string
Definition: CORE_Complex.cpp:41
#define tUInteger
Definition: types.h:91
static void parse(const tString &str, tUChar &c)
parse unsigned char c in str
Definition: CORE_String.h:504
tString toString() const
return the string associated to the real
Definition: CORE_Complex.h:111
static tBoolean string2Boolean(const tString &c)
return the booleazn corresponding to string
Definition: CORE_String.h:470
CORE_String & operator-=(SP::CORE_String s)
remove the s tring from this string
Definition: CORE_String.h:188
static tString toString(const tLInt &c)
return the string representation of long c
Definition: CORE_String.h:424
#define tFloat
Definition: types.h:50
tString getToken(const tUIndex &index)
get the token at index
Definition: CORE_String.h:286
#define tComplex
Definition: types.h:120
vector< tString >::iterator mTokenIndex
Definition: CORE_String.h:66
static tLDouble parseReal(const tString &str)
return the real associated to the string
Definition: CORE_Real.h:201
void toLower()
turn the string to lower case
Definition: CORE_String.h:365
tString substring(const tUIndex &from, const tUIndex &to) const
return the string between from & to indices from index is included, to is not
Definition: CORE_String.h:661
tUIndex findFirstSeparator(const tString &words, tUIndex &sepLength) const
Definition: CORE_String.cpp:39
#define tUSInt
Definition: types.h:28
void trim()
trim
Definition: CORE_String.h:698
void replaceFirst(const tString &strToReplace, const tString &str)
replace first instance of strToReplace by str
Definition: CORE_String.h:298
#define tBoolean
Definition: types.h:139
static void parse(const tString &str, tSInt &c)
parse short c in str
Definition: CORE_String.h:509
static tString toString(const tULInt &c)
return the string representation of unsigned long c
Definition: CORE_String.h:429
#define tLInt
Definition: types.h:42
static void parse(const tString &str, tLInt &c)
parse long c in str
Definition: CORE_String.h:524
tUIndex length() const
get the size of the size
Definition: CORE_String.h:679
virtual tString toString() const
return the string associated to the string
Definition: CORE_String.h:223
tUIndex indexOf(const tString &v, const tUIndex &fromIndex) const
return the index of char v in this->mString from fromIndex index
Definition: CORE_String.h:616
CORE_String()
create a string
Definition: CORE_String.cpp:16
static tString keepOnlyFirstLines(const tString &str, const tUIndex &nLines, tBoolean &isTruncated)
keep only the first lines of parameter str
Definition: CORE_String.cpp:331
tString toString() const
return the string associated to the integer
Definition: CORE_Integer.h:106
static void parse(const tString &str, tBoolean &c)
parse boolean c in str
Definition: CORE_String.h:549
#define null
Definition: types.h:144
static void parse(const tString &str, tUSInt &c)
parse short c in str
Definition: CORE_String.h:514
void toUpper()
turn the string to upper case
Definition: CORE_String.h:353
CORE_String & operator-=(const CORE_String &s)
remove the s tring from this string
Definition: CORE_String.h:176
tString substring(const tUIndex &from) const
return the string from index
Definition: CORE_String.h:667
~CORE_String()
deleter
Definition: CORE_String.cpp:27
tString nextToken()
return the next token
Definition: CORE_String.h:278
tUIndex lastIndexOf(const tString &v) const
return the last index of v fin this->mString if not exists return CORE_Object::getMaxUIndex(); ...
Definition: CORE_String.h:595
static tString toString(const char *c)
return the string representation of char
Definition: CORE_String.h:373
void replaceLast(const tString &strToReplace, const tString &str)
replace last instance of strToReplace by str
Definition: CORE_String.h:304
tUIndex getTokensNumber() const
get the number of tokens
Definition: CORE_String.h:262
static void parse(const tString &str, tFloat &c)
parse float c in str
Definition: CORE_String.h:561
tUIndex indexOf(const tString &v) const
return the first index of v fin this->mString if not exists return CORE_Object::getMaxUIndex(); ...
Definition: CORE_String.h:588
static void parse(const tString &str, tComplex &c)
parse tComplex c in str
Definition: CORE_String.h:581
static tString toString(const tComplex &c)
return the string representation of complex c
Definition: CORE_String.h:483
static tString toString(const tUSInt &c)
return the string representation of unisgned short c
Definition: CORE_String.h:408
#define tULInt
Definition: types.h:39
#define SP_OBJECT(X)
Definition: CORE_Pointers.h:203
const char & operator[](const tUIndex &i) const
get the i-th element Assert in (i<size());
Definition: CORE_String.h:117
static SP::CORE_String New(const tString &str)
build an integer object
Definition: CORE_String.h:103
#define tLLInt
Definition: types.h:47
#define tSInt
Definition: types.h:30
static void parse(const tString &str, tULLInt &c)
parse unsigned long long c in str
Definition: CORE_String.h:544
void tokenize(const tString &separator)
tokenize the string with the separator
Definition: CORE_String.h:243
static tReal readReal(const tString &v)
read only real characters if not a real return 0
Definition: CORE_String.cpp:285
static tString toString(const tFloat &c)
return the string representation of float c
Definition: CORE_String.h:444
#define tUChar
Definition: types.h:20
static void parse(const tString &str, tDouble &c)
parse double c in str
Definition: CORE_String.h:566
#define tUInt
Definition: types.h:33
CORE_String & operator+=(const tString &s)
append the s String to the end
Definition: CORE_String.h:163
static void toUpper(tString &s)
to upper
Definition: CORE_String.h:345
CORE_String & operator+=(SP::CORE_String s)
append the s String to the end
Definition: CORE_String.h:169
static int readInteger(const tString &v)
read only integer characters
Definition: CORE_String.cpp:231
static tUInteger getOccurencesNumber(const tString &str, const tString &occ)
get the number of occurence of the string
Definition: CORE_String.cpp:202
static tString toString(const tUInt &c)
return the string representation of unsigned int c
Definition: CORE_String.h:418
void append(const tString &v)
append the string v to the string
Definition: CORE_String.h:684
char & operator[](const tUIndex &i)
get the i-th element Assert in (i<size());
Definition: CORE_String.h:125
#define tUIndex
Definition: types.h:126
static tString booleanToString(const tBoolean &c)
return the string representation true or false of boolean c
Definition: CORE_String.h:465
static tString toString(const tString &str, const tUIndex &len)
return the string associated to the string
Definition: CORE_String.h:335
static tString toString(const tChar &c)
return the string representation of char c
Definition: CORE_String.h:384
CORE_String & operator=(const CORE_String &s)
set the string to s
Definition: CORE_String.h:141
void setString(const char *str)
set the integer to i
Definition: CORE_String.h:203
tUIndex getTokensCount() const
get the number of tokens
Definition: CORE_String.h:257
void setString(const tString &str)
set the integer to i
Definition: CORE_String.h:198
static tString toString(const tSInt &c)
return the string representation of short c
Definition: CORE_String.h:403
abstract base class for most classes.
Definition: CORE_Object.h:53
#define tString
Definition: types.h:135
tString mString
Definition: CORE_String.h:65
#define tChar
Definition: types.h:23
void append(const char &v)
append the char v to the string
Definition: CORE_String.h:689
static tBoolean stringToBoolean(const tString &c)
return the booleazn corresponding to string
Definition: CORE_String.h:477
char * toCharArray() const
turn the string into char array
Definition: CORE_String.h:232
static void parse(const tString &str, tChar &c)
parse char c in str
Definition: CORE_String.h:556
static tString toString(const tInt &c)
return the string representation of int c
Definition: CORE_String.h:413
static SP::CORE_String New()
create a class String
Definition: CORE_String.h:96
static void toLower(tString &s)
to lower
Definition: CORE_String.h:359
tString toString() const
return the string associated to the real
Definition: CORE_Real.h:97
static void parse(const tString &str, tUInt &c)
parse unsigned int c in str
Definition: CORE_String.h:534
static tString toString(const tULLInt &c)
return the string representation of unsigned long long c
Definition: CORE_String.h:439
static void truncate(tString &text, const tUInteger &nLines, const tUInteger &nCharsByLine)
truncate the message with nLines of nChars
Definition: CORE_String.cpp:363
CORE_String & operator=(SP::CORE_String s)
set the string to s
Definition: CORE_String.h:147
tBoolean hasNextToken() const
return true if there is another token
Definition: CORE_String.h:272
char charAt(const tUIndex &index) const
return the char at index
Definition: CORE_String.h:674
vector< tString > mSeparators
Definition: CORE_String.h:67
static tString toString(const tLDouble &c)
return the string representation of long double c
Definition: CORE_String.h:454
static void parse(const tString &str, tLLInt &c)
parse long long c in str
Definition: CORE_String.h:529
const tString & getString() const
get the string
Definition: CORE_String.h:214
vector< tString > mTokenizer
Definition: CORE_String.h:68
#define tULLInt
Definition: types.h:45
static char * stringToCharArray(const tString &str)
turn the string into char array
Definition: CORE_String.cpp:31
static void removeAll(tString &inOutStr, const tString &strToRemove)
remove the char at index
Definition: CORE_String.cpp:155
#define tInt
Definition: types.h:35
CORE_String & operator-=(const tString &s)
remove the s tring from this string
Definition: CORE_String.h:182
static tBoolean isDigit(const char &v)
return if the char is a digit
Definition: CORE_String.h:719
tUIndex getLastIndexOf(const tString &v) const
return the last index of v fin this->mString if not exists return CORE_Object::getMaxUIndex(); ...
Definition: CORE_String.h:602
#define tReal
Definition: types.h:118
static tString toString(const tUChar &c)
return the string representation of unsigned char c
Definition: CORE_String.h:396
static tString toString(const tLLInt &c)
return the string representation of long long c
Definition: CORE_String.h:434
void tokenize()
tokenize the string
Definition: CORE_String.cpp:68
#define ASSERT_IN(a)
Definition: types.h:196
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:141
static tBoolean isLetter(const char &v)
return if the char is a letter
Definition: CORE_String.h:712