TOP --> libjdl
Defines a simple string class.
This string class is used as the key for other classes in this library.
To tokenize strings use the jdlstringlist class.
#include "jdlstring.h"main(int argc,char* argv[]) { CJdlString str = "FOO"; str.lc(); // convert to lower case str.uc(); // convert to upper case str += " BAR"; // append more info. str.Format("This is my %d-th string.",10); // format it uint length = str.Length(); char ch = str[3]; // Get the 4-th character (0 based). CJdlString dnum(123.45); // Create a string from a double. if ( dnum == str ) { cout << "something strange is going on here..." << endl; } dnum = str; // Now they are equal. return 0; }
public CJdlString ( ) ;
Default constructor.
public CJdlString ( const CJdlString & obj ) ;
Copy constructor.
obj | Another CJdlString object. |
public CJdlString ( const char * obj ) ;
Constructor that initializes from a "C" string.
obj | A NULL terminated "C" string. |
public CJdlString ( char val ) ;
Constructor that initializes from a single character.
obj | A single character. |
public CJdlString ( int val ) ;
Constructor that initializes from a decimal integer.
val | An integer. |
public CJdlString ( double val ) ;
Constructor that initializes from a floating point number.
val | A floating point number. |
public ~ CJdlString ( ) ;
Destructor.
public void Resize ( uint size , bool copyFlag = true ) ;
Resize the internal buffer.
size | The new maximum length. |
copyFlag | If true, copy the old contents, otherwise init the string. |
public void Copy ( const CJdlString & obj ) ;
Copy a string object.
obj | Another string object. |
public void Copy ( const char * obj ) ;
Copy a "C" string.
obj | A NULL terminated "C" string. |
public void Copy ( char obj ) ;
Copy a single character.
obj | A single character. |
public void Copy ( int obj ) ;
Copy an int.
obj | An integer. |
public void Copy ( double ) ;
Copy a double.
obj | A double. |
public void Format ( const char * , . . . ) ;
Format the string using the same rules that are available for sprintf.
fmt | The formatting strings. |
... | The optional paramters. |
public uint Length ( ) const ;
Returns the length of the string.
public int Compare ( const CJdlString & obj ) const ;
Compare two strings.
obj | Another string object. |
public int Compare ( const char * ) const ;
Compare two strings.
obj | A C style string. |
public CJdlString & operator = ( const CJdlString & obj ) ;
Assignment operator.
obj | Another string object. |
public CJdlString & operator = ( const char * obj ) ;
Assignment operator.
obj | A C style string object. |
public uint operator == ( const CJdlString & ) const ;
Logical "equals" comparison operator.
CJdlString a("XXXX"); CJdlString b(a); if( a == b ) cout << "EQUAL" << endl;
obj | Another string object. |
public uint operator == ( const char * ) const ;
Logical "equals" comparison operator
obj | Another string object. |
public uint operator != ( const CJdlString & ) const ;
Logical "not equals" comparison operator.
CJdlString a("XXXX"); CJdlString b(a); if( a != b ) cout << "EQUAL" << endl;
obj | Another string object. |
public uint operator != ( const char * ) const ;
Logical "not equals" comparison operator
obj | Another string object. |
public uint operator <= ( const CJdlString & ) const ;
Logical "less than or equal to" comparison operator.
obj | Another string object. |
public uint operator <= ( const char * ) const ;
Logical "less than or equal to" comparison operator.
obj | Another string object. |
public uint operator >= ( const CJdlString & ) const ;
Logical "greater than or equal to" comparison operator.
obj | Another string object. |
public uint operator >= ( const char * ) const ;
Logical "greater than or equal to" comparison operator.
obj | Another string object. |
public uint operator < ( const CJdlString & ) const ;
Logical "less than" comparison operator.
obj | Another string object. |
public uint operator < ( const char * ) const ;
Logical "less than" comparison operator.
obj | Another string object. |
public uint operator > ( const CJdlString & ) const ;
Logical "greater than" comparison operator.
obj | Another string object. |
public uint operator > ( const char * ) const ;
Logical "greater than" comparison operator.
obj | Another string object. |
public operator const char * ( ) const ;
Cast operator.
public const char * str ( ) const ;
Cast method.
public void Append ( const CJdlString & obj ) ;
Append another string onto this one.
public void Append ( const char * obj ) ;
Append another C style string onto this one.
public void Append ( char ch ) ;
Append a character.
public CJdlString & operator += ( const CJdlString & obj ) ;
Append operator.
public CJdlString & operator += ( const char * obj ) ;
Append operator for C style strings.
public CJdlString & operator += ( char ch ) ;
Append operator for single characters.
public void uc ( ) ;
Convert to upper case.
public void lc ( ) ;
Convert to lower case.
public char operator [ ] ( int idx ) const ;
Return the character at the i-th position. This method does not do any bounds checking because it is safe. This allows programmers to do cool things without harming anything.
index | Character index (it can be negative). |
public char operator [ ] ( uint idx ) const ;
Return the character at the i-th position. This method does not do any bounds checking because it is safe. This allows programmers to do cool things without harming anything.
index | Character index (it must be positive). |
This documentation was generated automatically by the ccdoc tool (version 0.7a).
Click here to submit a bug report or feature request.
Click here to return to the top of the page.