Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FX::FXString Class Reference

FXString provides essential string manipulation capabilities. More...

#include <FXString.h>

List of all members.

Public Member Functions

 FXString ()
 FXString (const FXString &s)
 FXString (const FXchar *s)
 FXString (const FXchar *s, FXint n)
 FXString (FXchar c, FXint n)
 FXString (const FXchar *s1, const FXchar *s2)
void length (FXint len)
FXint length () const
const FXchar * text () const
FXbool empty () const
FXchar & operator[] (FXint i)
const FXchar & operator[] (FXint i) const
FXString & operator= (const FXString &s)
FXString & operator= (const FXchar *s)
FXString & fill (FXchar c, FXint n)
FXString & fill (FXchar c)
FXString & lower ()
FXString & upper ()
FXString section (FXchar delim, FXint start, FXint num=1) const
FXString section (const FXchar *delim, FXint n, FXint start, FXint num) const
FXString section (const FXchar *delim, FXint start, FXint num=1) const
FXString section (const FXString &delim, FXint start, FXint num=1) const
FXString & assign (FXchar c)
FXString & assign (FXchar c, FXint n)
FXString & assign (const FXchar *s, FXint n)
FXString & assign (const FXString &s)
FXString & assign (const FXchar *s)
FXString & insert (FXint pos, FXchar c)
FXString & insert (FXint pos, FXchar c, FXint n)
FXString & insert (FXint pos, const FXchar *s, FXint n)
FXString & insert (FXint pos, const FXString &s)
FXString & insert (FXint pos, const FXchar *s)
FXString & prepend (FXchar c)
FXString & prepend (FXchar c, FXint n)
FXString & prepend (const FXchar *s, FXint n)
FXString & prepend (const FXString &s)
FXString & prepend (const FXchar *s)
FXString & append (FXchar c)
FXString & append (FXchar c, FXint n)
FXString & append (const FXchar *s, FXint n)
FXString & append (const FXString &s)
FXString & append (const FXchar *s)
FXString & replace (FXint pos, FXchar c)
FXString & replace (FXint pos, FXint m, FXchar c, FXint n)
FXString & replace (FXint pos, FXint m, const FXchar *s, FXint n)
FXString & replace (FXint pos, FXint m, const FXString &s)
FXString & replace (FXint pos, FXint m, const FXchar *s)
FXString & remove (FXint pos, FXint n=1)
FXint contains (FXchar ch)
FXint contains (const FXchar *sub, FXint n)
FXint contains (const FXchar *sub)
FXint contains (const FXString &sub)
FXString & substitute (FXchar org, FXchar sub, FXbool all=TRUE)
FXString & substitute (const FXchar *org, FXint olen, const FXchar *rep, FXint rlen, FXbool all=TRUE)
FXString & substitute (const FXchar *org, const FXchar *rep, FXbool all=TRUE)
FXString & substitute (const FXString &org, const FXString &rep, FXbool all=TRUE)
FXString & simplify ()
FXString & trim ()
FXString & trimBegin ()
FXString & trimEnd ()
FXString & trunc (FXint pos)
FXString & clear ()
FXString left (FXint n) const
FXString right (FXint n) const
FXString mid (FXint pos, FXint n) const
FXString before (FXchar ch, FXint n=1) const
FXString rbefore (FXchar ch, FXint n=1) const
FXString after (FXchar ch, FXint n=1) const
FXString rafter (FXchar ch, FXint n=1) const
FXint find (FXchar c, FXint pos=0) const
FXint rfind (FXchar c, FXint pos=2147483647) const
FXint find (FXchar c, FXint pos, FXint n) const
FXint rfind (FXchar c, FXint pos, FXint n) const
FXint find (const FXchar *substr, FXint n, FXint pos) const
FXint rfind (const FXchar *substr, FXint n, FXint pos) const
FXint find (const FXchar *substr, FXint pos=0) const
FXint rfind (const FXchar *substr, FXint pos=2147483647) const
FXint find (const FXString &substr, FXint pos=0) const
FXint rfind (const FXString &substr, FXint pos=2147483647) const
FXint find_first_of (const FXchar *set, FXint n, FXint pos) const
FXint find_first_of (const FXchar *set, FXint pos=0) const
FXint find_first_of (const FXString &set, FXint pos=0) const
FXint find_first_of (FXchar c, FXint pos=0) const
FXint find_last_of (const FXchar *set, FXint n, FXint pos) const
FXint find_last_of (const FXchar *set, FXint pos=2147483647) const
FXint find_last_of (const FXString &set, FXint pos=2147483647) const
FXint find_last_of (FXchar c, FXint pos=0) const
FXint find_first_not_of (const FXchar *set, FXint n, FXint pos) const
FXint find_first_not_of (const FXchar *set, FXint pos=0) const
FXint find_first_not_of (const FXString &set, FXint pos=0) const
FXint find_first_not_of (FXchar c, FXint pos=0) const
FXint find_last_not_of (const FXchar *set, FXint n, FXint pos) const
FXint find_last_not_of (const FXchar *set, FXint pos=2147483647) const
FXint find_last_not_of (const FXString &set, FXint pos=2147483647) const
FXint find_last_not_of (FXchar c, FXint pos=0) const
FXint count (FXchar c) const
FXString & format (const char *fmt,...) FX_PRINTF(2
FXString & vformat (const char *fmt, va_list args)
FXint scan (const char *fmt,...) const FX_SCANF(2
FXint vscan (const char *fmt, va_list args) const
FXuint hash () const
FXString & operator+= (const FXString &s)
FXString & operator+= (const FXchar *s)
FXString & operator+= (FXchar c)
 ~FXString ()

Static Public Attributes

const FXchar null []
const FXchar hex [17]
const FXchar HEX [17]

Friends

FXint compare (const FXchar *s1, const FXchar *s2)
FXint compare (const FXchar *s1, const FXString &s2)
FXint compare (const FXString &s1, const FXchar *s2)
FXint compare (const FXString &s1, const FXString &s2)
FXint compare (const FXchar *s1, const FXchar *s2, FXint n)
FXint compare (const FXchar *s1, const FXString &s2, FXint n)
FXint compare (const FXString &s1, const FXchar *s2, FXint n)
FXint compare (const FXString &s1, const FXString &s2, FXint n)
FXint comparecase (const FXchar *s1, const FXchar *s2)
FXint comparecase (const FXchar *s1, const FXString &s2)
FXint comparecase (const FXString &s1, const FXchar *s2)
FXint comparecase (const FXString &s1, const FXString &s2)
FXint comparecase (const FXchar *s1, const FXchar *s2, FXint n)
FXint comparecase (const FXchar *s1, const FXString &s2, FXint n)
FXint comparecase (const FXString &s1, const FXchar *s2, FXint n)
FXint comparecase (const FXString &s1, const FXString &s2, FXint n)
FXbool operator== (const FXString &s1, const FXString &s2)
FXbool operator== (const FXString &s1, const FXchar *s2)
FXbool operator== (const FXchar *s1, const FXString &s2)
FXbool operator!= (const FXString &s1, const FXString &s2)
FXbool operator!= (const FXString &s1, const FXchar *s2)
FXbool operator!= (const FXchar *s1, const FXString &s2)
FXbool operator< (const FXString &s1, const FXString &s2)
FXbool operator< (const FXString &s1, const FXchar *s2)
FXbool operator< (const FXchar *s1, const FXString &s2)
FXbool operator<= (const FXString &s1, const FXString &s2)
FXbool operator<= (const FXString &s1, const FXchar *s2)
FXbool operator<= (const FXchar *s1, const FXString &s2)
FXbool operator> (const FXString &s1, const FXString &s2)
FXbool operator> (const FXString &s1, const FXchar *s2)
FXbool operator> (const FXchar *s1, const FXString &s2)
FXbool operator>= (const FXString &s1, const FXString &s2)
FXbool operator>= (const FXString &s1, const FXchar *s2)
FXbool operator>= (const FXchar *s1, const FXString &s2)
FXString operator+ (const FXString &s1, const FXString &s2)
FXString operator+ (const FXString &s1, const FXchar *s2)
FXString operator+ (const FXchar *s1, const FXString &s2)
FXString operator+ (const FXString &s, FXchar c)
FXString operator+ (FXchar c, const FXString &s)
FXStream & operator<< (FXStream &store, const FXString &s)
FXStream & operator>> (FXStream &store, FXString &s)
FXString FXStringFormat (const FXchar *fmt,...) FX_PRINTF(1
FXString FXStringVFormat (const FXchar *fmt, va_list args)
FXString FXStringVal (FXint num, FXint base=10)
FXString FXStringVal (FXuint num, FXint base=10)
FXString FXStringVal (FXlong num, FXint base=10)
FXString FXStringVal (FXulong num, FXint base=10)
FXString FXStringVal (FXfloat num, FXint prec=6, FXbool exp=MAYBE)
FXString FXStringVal (FXdouble num, FXint prec=6, FXbool exp=MAYBE)
FXint FXIntVal (const FXString &s, FXint base=10)
FXuint FXUIntVal (const FXString &s, FXint base=10)
FXlong FXLongVal (const FXString &s, FXint base=10)
FXulong FXULongVal (const FXString &s, FXint base=10)
FXfloat FXFloatVal (const FXString &s)
FXdouble FXDoubleVal (const FXString &s)
FXString escape (const FXString &s)
FXString unescape (const FXString &s)
void swap (FXString &a, FXString &b)


Detailed Description

FXString provides essential string manipulation capabilities.


Constructor & Destructor Documentation

FXString (   ) 
 

Create empty string.

FX::FXString::FXString (  const FXString &  s  ) 
 

Copy construct.

FX::FXString::FXString (  const FXchar *  s  ) 
 

Construct and init.

FX::FXString::FXString (  const FXchar *  s,
FXint  n
) 
 

Construct and init with substring.

FX::FXString::FXString (  FXchar  c,
FXint  n
) 
 

Construct and fill with constant.

FX::FXString::FXString (  const FXchar *  s1,
const FXchar *  s2
) 
 

Construct string from two parts.

FX::FXString::~FXString (   ) 
 

Delete.


Member Function Documentation

void FX::FXString::length (  FXint  len  ) 
 

Change the length of the string to len.

FXint FX::FXString::length (   )  const [inline]
 

Length of text.

const FXchar* FX::FXString::text (   )  const [inline]
 

Get text contents.

FXbool FX::FXString::empty (   )  const [inline]
 

See if string is empty.

FXchar& FX::FXString::operator[] (  FXint  i  )  [inline]
 

Return a non-const reference to the ith character.

const FXchar& FX::FXString::operator[] (  FXint  i  )  const [inline]
 

Return a const reference to the ith character.

FXString& FX::FXString::operator= (  const FXString &  s  ) 
 

Assign another string to this.

FXString& FX::FXString::operator= (  const FXchar *  s  ) 
 

Assign a C-style string to this.

FXString& FX::FXString::fill (  FXchar  c,
FXint  n
) 
 

Fill with a constant.

FXString& FX::FXString::fill (  FXchar  c  ) 
 

Fill up to current length.

FXString& FX::FXString::lower (   ) 
 

Convert to lower case.

FXString& FX::FXString::upper (   ) 
 

Convert to upper case.

FXString FX::FXString::section (  FXchar  delim,
FXint  start,
FXint  num = 1
)  const
 

Return num partition(s) beginning at start from a string separated by delimiters delim.

FXString FX::FXString::section (  const FXchar *  delim,
FXint  n,
FXint  start,
FXint  num
)  const
 

Return num partition(s) beginning at start from a string separated by set of delimiters from delim of size n.

FXString FX::FXString::section (  const FXchar *  delim,
FXint  start,
FXint  num = 1
)  const
 

Return num partition(s) beginning at start from a string separated by set of delimiters from delim.

FXString FX::FXString::section (  const FXString &  delim,
FXint  start,
FXint  num = 1
)  const
 

Return num partition(s) beginning at start from a string separated by set of delimiters from delim.

FXString& FX::FXString::assign (  FXchar  c  ) 
 

Assign character c to this string.

FXString& FX::FXString::assign (  FXchar  c,
FXint  n
) 
 

Assign n characters c to this string.

FXString& FX::FXString::assign (  const FXchar *  s,
FXint  n
) 
 

Assign first n characters of string s to this string.

FXString& FX::FXString::assign (  const FXString &  s  ) 
 

Assign string s to this string.

FXString& FX::FXString::assign (  const FXchar *  s  ) 
 

Assign string s to this string.

FXString& FX::FXString::insert (  FXint  pos,
FXchar  c
) 
 

Insert character at specified position.

FXString& FX::FXString::insert (  FXint  pos,
FXchar  c,
FXint  n
) 
 

Insert n characters c at specified position.

FXString& FX::FXString::insert (  FXint  pos,
const FXchar *  s,
FXint  n
) 
 

Insert first n characters of string at specified position.

FXString& FX::FXString::insert (  FXint  pos,
const FXString &  s
) 
 

Insert string at specified position.

FXString& FX::FXString::insert (  FXint  pos,
const FXchar *  s
) 
 

Insert string at specified position.

FXString& FX::FXString::prepend (  FXchar  c  ) 
 

Prepend string with input character.

FXString& FX::FXString::prepend (  FXchar  c,
FXint  n
) 
 

Prepend string with n characters c.

FXString& FX::FXString::prepend (  const FXchar *  s,
FXint  n
) 
 

Prepend string with first n characters of input string.

FXString& FX::FXString::prepend (  const FXString &  s  ) 
 

Prepend string with input string.

FXString& FX::FXString::prepend (  const FXchar *  s  ) 
 

Prepend string with input string.

FXString& FX::FXString::append (  FXchar  c  ) 
 

Append input character to this string.

FXString& FX::FXString::append (  FXchar  c,
FXint  n
) 
 

Append input n characters c to this string.

FXString& FX::FXString::append (  const FXchar *  s,
FXint  n
) 
 

Append first n characters of input string to this string.

FXString& FX::FXString::append (  const FXString &  s  ) 
 

Append input string to this string.

FXString& FX::FXString::append (  const FXchar *  s  ) 
 

Append input string to this string.

FXString& FX::FXString::replace (  FXint  pos,
FXchar  c
) 
 

Replace a single character.

FXString& FX::FXString::replace (  FXint  pos,
FXint  m,
FXchar  c,
FXint  n
) 
 

Replace the m characters at pos with n characters c.

FXString& FX::FXString::replace (  FXint  pos,
FXint  m,
const FXchar *  s,
FXint  n
) 
 

Replaces the m characters at pos with first n characters of input string.

FXString& FX::FXString::replace (  FXint  pos,
FXint  m,
const FXString &  s
) 
 

Replace the m characters at pos with input string.

FXString& FX::FXString::replace (  FXint  pos,
FXint  m,
const FXchar *  s
) 
 

Replace the m characters at pos with input string.

FXString& FX::FXString::remove (  FXint  pos,
FXint  n = 1
) 
 

Remove substring.

FXint FX::FXString::contains (  FXchar  ch  ) 
 

Return number of occurrences of ch in string.

FXint FX::FXString::contains (  const FXchar *  sub,
FXint  n
) 
 

Return number of occurrences of string sub in string.

FXint FX::FXString::contains (  const FXchar *  sub  ) 
 

Return number of occurrences of string sub in string.

FXint FX::FXString::contains (  const FXString &  sub  ) 
 

Return number of occurrences of string sub in string.

FXString& FX::FXString::substitute (  FXchar  org,
FXchar  sub,
FXbool  all = TRUE
) 
 

Substitute one character by another.

FXString& FX::FXString::substitute (  const FXchar *  org,
FXint  olen,
const FXchar *  rep,
FXint  rlen,
FXbool  all = TRUE
) 
 

Substitute one string by another.

FXString& FX::FXString::substitute (  const FXchar *  org,
const FXchar *  rep,
FXbool  all = TRUE
) 
 

Substitute one string by another.

FXString& FX::FXString::substitute (  const FXString &  org,
const FXString &  rep,
FXbool  all = TRUE
) 
 

Substitute one string by another.

FXString& FX::FXString::simplify (   ) 
 

Simplify whitespace in string.

FXString& FX::FXString::trim (   ) 
 

Remove leading and trailing whitespace.

FXString& FX::FXString::trimBegin (   ) 
 

Remove leading whitespace.

FXString& FX::FXString::trimEnd (   ) 
 

Remove trailing whitespace.

FXString& FX::FXString::trunc (  FXint  pos  ) 
 

Truncate string at pos.

FXString& FX::FXString::clear (   ) 
 

Clear.

FXString FX::FXString::left (  FXint  n  )  const
 

Get left most part.

FXString FX::FXString::right (  FXint  n  )  const
 

Get right most part.

FXString FX::FXString::mid (  FXint  pos,
FXint  n
)  const
 

Get some part in the middle.

FXString FX::FXString::before (  FXchar  ch,
FXint  n = 1
)  const
 

Return all characters before the n-th occurrence of ch, searching from the beginning of the string.

If the character is not found, return the entire string. If n<=0, return the empty string.

FXString FX::FXString::rbefore (  FXchar  ch,
FXint  n = 1
)  const
 

Return all characters before the n-th occurrence of ch, searching from the end of the string.

If the character is not found, return the empty string. If n<=0, return the entire string.

FXString FX::FXString::after (  FXchar  ch,
FXint  n = 1
)  const
 

Return all characters after the nth occurrence of ch, searching from the beginning of the string.

If the character is not found, return the empty string. If n<=0, return the entire string.

FXString FX::FXString::rafter (  FXchar  ch,
FXint  n = 1
)  const
 

Return all characters after the nth occurrence of ch, searching from the end of the string.

If the character is not found, return the entire string. If n<=0, return the empty string.

FXint FX::FXString::find (  FXchar  c,
FXint  pos = 0
)  const
 

Find a character, searching forward; return position or -1.

FXint FX::FXString::rfind (  FXchar  c,
FXint  pos = 2147483647
)  const
 

Find a character, searching backward; return position or -1.

FXint FX::FXString::find (  FXchar  c,
FXint  pos,
FXint  n
)  const
 

Find n-th occurrence of character, searching forward; return position or -1.

FXint FX::FXString::rfind (  FXchar  c,
FXint  pos,
FXint  n
)  const
 

Find n-th occurrence of character, searching backward; return position or -1.

FXint FX::FXString::find (  const FXchar *  substr,
FXint  n,
FXint  pos
)  const
 

Find a substring of length n, searching forward; return position or -1.

FXint FX::FXString::rfind (  const FXchar *  substr,
FXint  n,
FXint  pos
)  const
 

Find a substring of length n, searching backward; return position or -1.

FXint FX::FXString::find (  const FXchar *  substr,
FXint  pos = 0
)  const
 

Find a substring, searching forward; return position or -1.

FXint FX::FXString::rfind (  const FXchar *  substr,
FXint  pos = 2147483647
)  const
 

Find a substring, searching backward; return position or -1.

FXint FX::FXString::find (  const FXString &  substr,
FXint  pos = 0
)  const
 

Find a substring, searching forward; return position or -1.

FXint FX::FXString::rfind (  const FXString &  substr,
FXint  pos = 2147483647
)  const
 

Find a substring, searching backward; return position or -1.

FXint FX::FXString::find_first_of (  const FXchar *  set,
FXint  n,
FXint  pos
)  const
 

Find first character in the set of size n, starting from pos; return position or -1.

FXint FX::FXString::find_first_of (  const FXchar *  set,
FXint  pos = 0
)  const
 

Find first character in the set, starting from pos; return position or -1.

FXint FX::FXString::find_first_of (  const FXString &  set,
FXint  pos = 0
)  const
 

Find first character in the set, starting from pos; return position or -1.

FXint FX::FXString::find_first_of (  FXchar  c,
FXint  pos = 0
)  const
 

Find first character, starting from pos; return position or -1.

FXint FX::FXString::find_last_of (  const FXchar *  set,
FXint  n,
FXint  pos
)  const
 

Find last character in the set of size n, starting from pos; return position or -1.

FXint FX::FXString::find_last_of (  const FXchar *  set,
FXint  pos = 2147483647
)  const
 

Find last character in the set, starting from pos; return position or -1.

FXint FX::FXString::find_last_of (  const FXString &  set,
FXint  pos = 2147483647
)  const
 

Find last character in the set, starting from pos; return position or -1.

FXint FX::FXString::find_last_of (  FXchar  c,
FXint  pos = 0
)  const
 

Find last character, starting from pos; return position or -1.

FXint FX::FXString::find_first_not_of (  const FXchar *  set,
FXint  n,
FXint  pos
)  const
 

Find first character NOT in the set of size n, starting from pos; return position or -1.

FXint FX::FXString::find_first_not_of (  const FXchar *  set,
FXint  pos = 0
)  const
 

Find first character NOT in the set, starting from pos; return position or -1.

FXint FX::FXString::find_first_not_of (  const FXString &  set,
FXint  pos = 0
)  const
 

Find first character NOT in the set, starting from pos; return position or -1.

FXint FX::FXString::find_first_not_of (  FXchar  c,
FXint  pos = 0
)  const
 

Find first character NOT equal to c, starting from pos; return position or -1.

FXint FX::FXString::find_last_not_of (  const FXchar *  set,
FXint  n,
FXint  pos
)  const
 

Find last character NOT in the set of size n, starting from pos; return position or -1.

FXint FX::FXString::find_last_not_of (  const FXchar *  set,
FXint  pos = 2147483647
)  const
 

Find last character NOT in the set, starting from pos; return position or -1.

FXint FX::FXString::find_last_not_of (  const FXString &  set,
FXint  pos = 2147483647
)  const
 

Find last character NOT in the set, starting from pos; return position or -1.

FXint FX::FXString::find_last_not_of (  FXchar  c,
FXint  pos = 0
)  const
 

Find last character NOT equal to c, starting from pos; return position or -1.

FXint FX::FXString::count (  FXchar  c  )  const
 

Find number of occurrences of character in string.

FXString& FX::FXString::format (  const char *  fmt,
  ...
) 
 

Format a string a-la printf.

FXint FX::FXString::scan (  const char *  fmt,
  ...
)  const
 

Scan a string a-la scanf.

FXuint FX::FXString::hash (   )  const
 

Get hash value.

FXString& FX::FXString::operator+= (  const FXString &  s  ) 
 

Append operators.


Friends And Related Function Documentation

FXint compare (  const FXchar *  s1,
const FXchar *  s2
)  [friend]
 

Compare.

FXint compare (  const FXchar *  s1,
const FXchar *  s2,
FXint  n
)  [friend]
 

Compare up to n.

FXint comparecase (  const FXchar *  s1,
const FXchar *  s2
)  [friend]
 

Compare case insensitive.

FXint comparecase (  const FXchar *  s1,
const FXchar *  s2,
FXint  n
)  [friend]
 

Compare case insensitive up to n.

FXbool operator== (  const FXString &  s1,
const FXString &  s2
)  [friend]
 

Comparison operators.

FXString operator+ (  const FXString &  s1,
const FXString &  s2
)  [friend]
 

Concatenate two strings.

FXString operator+ (  const FXString &  s,
FXchar  c
)  [friend]
 

Concatenate with single character.

FXStream& operator<< (  FXStream &  store,
const FXString &  s
)  [friend]
 

Saving to a stream.

FXStream& operator>> (  FXStream &  store,
FXString &  s
)  [friend]
 

Load from a stream.

FXString FXStringFormat (  const FXchar *  fmt,
  ...
)  [friend]
 

Format a string a-la printf.

FXString FXStringVal (  FXint  num,
FXint  base = 10
)  [friend]
 

Convert integer number to a string, using the given number base, which must be between 2 and 16.

FXString FXStringVal (  FXlong  num,
FXint  base = 10
)  [friend]
 

Convert long integer number to a string, using the given number base, which must be between 2 and 16.

FXString FXStringVal (  FXfloat  num,
FXint  prec = 6,
FXbool  exp = MAYBE
)  [friend]
 

Convert real number to a string, using the given procision and exponential notation mode, which may be FALSE (never), TRUE (always), or MAYBE (when needed).

FXint FXIntVal (  const FXString &  s,
FXint  base = 10
)  [friend]
 

Convert string to a integer number, assuming given number base.

FXlong FXLongVal (  const FXString &  s,
FXint  base = 10
)  [friend]
 

Convert string to long integer number, assuming given number base.

FXfloat FXFloatVal (  const FXString &  s  )  [friend]
 

Convert string into real number.

FXString escape (  const FXString &  s  )  [friend]
 

Escape special characters in a string.

FXString unescape (  const FXString &  s  )  [friend]
 

Unescape special characters in a string.

void swap (  FXString &  a,
FXString &  b
)  [friend]
 

Swap two strings.

Copyright © 1997-2005 Jeroen van der Zijp