Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

otString Class Reference
[String List - Class for string list management, String List - Class for string list management]

Class for string management.

#include <otStringList.h>


Public Member Functions

 otString ()
 otString (const char *chr)
bool create (const char *chr)
U32 size ()
 Returns the number of characters in this string. The last character in the string is at position size() - 1.
void set (const char *chr)
 Init the class already allocated with a new string.
void close ()
 Free the memory of the allocated data.
const char * cstr ()
 Return the C string pointer.
bool append (const char c)
 Append specified the specified character.
bool append (const char *c)
 Append specified the specified string.
bool append (otString &app_str)
 Append specified the contents of the specified class.
bool replace (U32 index, const char new_char)
 Replace the character at the specified position.
U32 replace (const char old_char, const char new_char)
 Replace all characters specified with a new one.
int indexOf (const char *str_find, U32 initial_position=0)
 Returns the index position of the last occurrence of the string str in this string, searching backward from index position from.
int indexOf (otString &str_find, U32 initial_position=0)
 Returns the index position of the last occurrence of the string str in this string, searching backward from index position from.
bool contains (const char *str_find)
 Returns true if this string contains an occurrence of the string str; otherwise returns false.
bool contains (otString &str_find)
 Returns true if this string contains an occurrence of the string str; otherwise returns false.
int compare (otString &str)
 Compare with another string.
int compare (const char *str)
 Compare with another string.
bool chop ()
 Removes a character from the end of the string.
void toLower ()
 Convert to lowercase the string.
void toUpper ()
 Convert to uppercase the string.
bool startsWith (const char *txt)
 Returns true if the string starts with txt; otherwise returns false.
bool startsWith (otString &txt)
 Returns true if the string starts with txt; otherwise returns false.
bool endsWith (const char *txt)
 Returns true if the string ends with txt; otherwise returns false.
bool endsWith (otString &txt)
 Returns true if the string ends with txt; otherwise returns false.
bool insert (U32 pos, const char *txt)
 Insert a string at the specified position.
bool insert (U32 pos, otString &txt)
 Insert a string at the specified position.
otString left (U32 n)
 Returns a substring that contains the n leftmost characters of the string.
otString right (U32 n)
 Returns a substring that contains the n rightmost characters of the string.
otString mid (U32 position, int n=-1)
 Returns a string that contains n characters of this string, starting at the specified position index.
U32 simplified ()
 Returns a string that has whitespace removed from the start and the end, and that has each sequence of internal whitespace replaced with a single space. This includes the ASCII characters '\t', '\n', '\v', '\f', '\r', and ' '.
bool isEmpty ()
 Returns true if the string has no characters; otherwise returns false.
S32 toInt (int base)
 Returns the string converted to an int using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. If base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.
U32 toUInt (int base)
 Returns the string converted to an unsigned int using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. If base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.
S64 toLongLong (int base)
 Returns the string converted to an unsigned long long using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. If base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.
U64 toULongLong (int base)
 Returns the string converted to a long long using base base, which is 10 by default and must be between 2 and 36, or 0. Returns 0 if the conversion fails. If base is 0, the C language convention is used: If the string begins with "0x", base 16 is used; if the string begins with "0", base 8 is used; otherwise, base 10 is used.
otStringList split (const char *sep)
 Splits the string into substrings wherever sep occurs, and returns the list of those strings. If sep does not match anywhere in the string, split() returns a single-element list containing this string.
otStringList split (otString &sep)
 Splits the string into substrings wherever sep occurs, and returns the list of those strings. If sep does not match anywhere in the string, split() returns a single-element list containing this string.


Constructor & Destructor Documentation

otString.otString (   ) 
 

Create an empty class

otString.otString (  const char *  chr  ) 
 

Create a class with the specified string

Parameters:
chr C string used to init the class


Member Function Documentation

bool otString.append (  otString &  app_str  ) 
 

Returns:
True on success

bool otString.append (  const char *  c  ) 
 

Returns:
True on success

bool otString.append (  const char  c  ) 
 

Returns:
True on success

bool otString.chop (   ) 
 

Returns:
True on success

void otString.close (   ) 
 

int otString.compare (  const char *  str  ) 
 

Parameters:
str String to be compared
Returns:
An integral value indicating the relationship between the strings:
0 the contents of both strings are equal

int otString.compare (  otString &  str  ) 
 

Parameters:
str String to be compared
Returns:
An integral value indicating the relationship between the strings:
0 the contents of both strings are equal

bool otString.contains (  otString &  str_find  ) 
 

Parameters:
str_find String to be searched
Returns:
True on success

bool otString.contains (  const char *  str_find  ) 
 

Parameters:
str_find String to be searched
Returns:
True on success

bool otString.create (  const char *  chr  ) 
 

Init an empty class

Parameters:
chr C string used to init the class

const char* otString.cstr (   ) 
 

bool otString.endsWith (  otString &  txt  ) 
 

Returns:
True on success

bool otString.endsWith (  const char *  txt  ) 
 

Returns:
True on success

int otString.indexOf (  otString &  str_find,
U32  initial_position = 0
) 
 

Parameters:
str_find String to be searched
initial_position Start postion for the search
Returns:
Returns -1 if str is not found.

int otString.indexOf (  const char *  str_find,
U32  initial_position = 0
) 
 

Parameters:
str_find String to be searched
initial_position Start postion for the search
Returns:
Returns -1 if str is not found.

bool otString.insert (  U32  pos,
otString &  txt
) 
 

Returns:
True on success

bool otString.insert (  U32  pos,
const char *  txt
) 
 

Returns:
True on success

bool otString.isEmpty (   ) 
 

Returns:
True if empty

otString otString.left (  U32  n  ) 
 

Returns:
Output string

otString otString.mid (  U32  position,
int  n = -1
) 
 

Returns:
Output string

U32 otString.replace (  const char  old_char,
const char  new_char
) 
 

Parameters:
old_char Character to be replaced
new_char Character used for replace\
Returns:
The number of replaced characters

bool otString.replace (  U32  index,
const char  new_char
) 
 

Parameters:
index Character position
new_char Character used for replace
Returns:
True on success

otString otString.right (  U32  n  ) 
 

Returns:
Output string

void otString.set (  const char *  chr  ) 
 

U32 otString.simplified (   ) 
 

Returns:
String size

U32 otString.size (   ) 
 

otStringList otString.split (  otString &  sep  ) 
 

Returns:
String list

otStringList otString.split (  const char *  sep  ) 
 

Returns:
String list

bool otString.startsWith (  otString &  txt  ) 
 

Returns:
True on success

bool otString.startsWith (  const char *  txt  ) 
 

Returns:
True on success

S32 otString.toInt (  int  base  ) 
 

Returns:
Converted number

S64 otString.toLongLong (  int  base  ) 
 

Returns:
Converted number

void otString.toLower (   ) 
 

U32 otString.toUInt (  int  base  ) 
 

Returns:
Converted number

U64 otString.toULongLong (  int  base  ) 
 

Returns:
Converted number

void otString.toUpper (   ) 
 


The documentation for this class was generated from the following file: footer
otStudio - Library Reference - (C) 2020-25 Officina Turini, All Rights Reserved
Document built with Doxygen 1.4.0