summaryrefslogtreecommitdiff
path: root/src/examples/xb_ex_string.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/examples/xb_ex_string.cpp')
-rwxr-xr-xsrc/examples/xb_ex_string.cpp73
1 files changed, 34 insertions, 39 deletions
diff --git a/src/examples/xb_ex_string.cpp b/src/examples/xb_ex_string.cpp
index 3d582a1..30fd74e 100755
--- a/src/examples/xb_ex_string.cpp
+++ b/src/examples/xb_ex_string.cpp
@@ -65,15 +65,18 @@ int main()
// trim methods
s3 = " abc ";
s3.Ltrim();
+ #ifdef XB_DEBUG_SUPPORT
s3.Dump( "LTrim test" );
-
+ #else
+ std::cout << s3.Str() << std::endl;
+ #endif
s3 = " abc ";
s3.Rtrim();
- s3.Dump( "RTrim test" );
+ std::cout << "RTrim test - " << s3.Str() << std::endl;
s3.Trim();
- s3.Dump( "Trim test" );
+ std::cout << "Trim test - " << s3.Str() << std::endl;
printf( "s3 Len = [%d]\n", s3.Len() );
// Concatenation tests - I
@@ -88,29 +91,24 @@ int main()
s1 -= "Concatenation test1 part 2 ";
s1 -= 'X';
s1 -= s2;
- s1.Dump( "Concatenation test 2 " );
-
+ std::cout << "Concatenation test 2 - " << s1.Str() << std::endl;
// Concatenation tests - III
s1 = "s1data ";
s2 = "s2data ";
s3 = s1 - s2;
- s3.Dump( "Concatenation test 3a" );
+ std::cout << "Concatenation test 3a - " << s3.Str() << std::endl;
s3 = s1 + s2;
- s3.Dump( "Concatenation test 3b" );
+ std::cout << "Concatenation test 3b - " << s3.Str() << std::endl;
s3 = s1 + " char * data ";
- s3.Dump( "Concatenation test 3c" );
-
- // s3 = " char * data " + s2;
- // s3.Dump( "Concatenation test 3d" );
+ std::cout << "Concatenation test 3c - " << s3.Str() << std::endl;
s3 = s1 + 'Z';
- s3.Dump( "Concatenation test 3e" );
+ std::cout << "Concatenation test 3d - " << s3.Str() << std::endl;
-// s3 = 'A' + s1;
s3 = 'A';
std::cout << s3.Str() << std::endl;
@@ -118,14 +116,8 @@ int main()
std::cout << s3.Str() << std::endl;
-
- s3 = 'A' + s1;
-
-
- return 0;
-
- // s3.Dump( "Concatenation test 3f" );
-
+ s3 = 'A' + s1;
+
std::cout << std::endl << "== operator tests" << std::endl;
if( s1 == s2 )
std::cout << s1.Str() << " == " << s2.Str() << std::endl;
@@ -145,8 +137,9 @@ int main()
std::cout << std::endl << "!= operator tests" << std::endl;
s2 = "abc123";
- s1.Dump( "s1" );
- s2.Dump( "s2" );
+ std::cout << "s1 - " << s1.Str() << std::endl;
+ std::cout << "s2 - " << s2.Str() << std::endl;
+
if( s1 != s2 )
std::cout << s1.Str() << " != " << s2.Str() << std::endl;
else
@@ -284,7 +277,7 @@ int main()
std::cout << "s2 = " << s2.Str() << std::endl;
s1 = s2.Copy();
- s1.Dump( "s1.Copy() results" );
+ std::cout << "s1.Copy() results" << s1.Str() << std::endl;
s1 = "0x35";
char hexChar;
@@ -299,7 +292,7 @@ int main()
std::cout << "CvtHexString [" << s1.Str() << "] converts to [" << s2.Str() << "]" << std::endl;
s1.ExtractElement( "aaaa|bbbb|cccc|dddd", '|', 2, 0 );
- s1.Dump( "ExtractElement() " );
+ std::cout << "ExtractElement() " << s1.Str() << std::endl;
s1 = "123";
s2 = "ABC";
@@ -317,50 +310,52 @@ int main()
std::cout << s1.Str() << " s1.Pos('G') = " << s1.Pos( 'G' ) << std::endl;
std::cout << s1.Str() << " s1.Pos(\"JKL\") = " << s1.Pos( "JKL" ) << std::endl;
- s1.Dump( "Remove( 3, 5 ) before " );
+ std::cout << "Remove( 3, 5 ) before " << s1.Str() << std::endl;
std::cout << s1.Str() << " s1.Remove( 3, 5 ) = [" << s1.Remove( 3, 5 ).Str() << "]" << std::endl;
- s1.Dump( "Remove( 3, 5 ) after " );
+ std::cout << "Remove( 3, 5 ) after " << s1.Str() << std::endl;
s1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
std::cout << "s1.Remove( 20, 10 ) = [" << s1.Remove( 20, 10 ).Str() << "]" << std::endl;
- s1.Dump( "Remove( 20, 10 ) " );
+
+ std::cout << "Remove( 20, 10 ) - " << s1.Str() << std::endl;
+
s1.Sprintf( "%d", 12345 );
- s1.Dump( "Sprintf( %d, 12345 ) " );
+ std::cout << "Sprintf( %d, 12345 ) " << s1.Str() << std::endl;
s1.SetNum( (long) 123456 );
std::cout << "s1.SetNum( 123456 ) = " << s1.Str() << std::endl;
s1.Set( "Yet another way to set a string value" );
- s1.Dump( "Set" );
+ std::cout << "Set - " << s1.Str() << std::endl;
s1 = "ABCABCABZ";
- s1.Dump( "SwapChars( 'A', '9' ) before" );
+ std::cout << "SwapChars( 'A', '9' ) before - " << s1.Str() << std::endl;
s1.SwapChars( 'A', '9' );
- s1.Dump( "SwapChars( 'A', '9' ) after");
+ std::cout << "SwapChars( 'A', '9' ) after - " << s1.Str() << std::endl;
s1.ToLowerCase();
- s1.Dump( "ToLowerCase" );
+ std::cout << "ToLowerCase - " << s1.Str() << std::endl;
s1.ToUpperCase();
- s1.Dump( "ToUpperCase" );
+ std::cout << "ToUpperCase - " << s1.Str() << std::endl;
s1.ZapChar( '9' );
- s1.Dump( "ZapChar( '9' )" );
+ std::cout << "ZapChar( '9' )" << s1.Str() << std::endl;
s1.ZapLeadingChar( 'B' );
- s1.Dump( "ZapLeadingChar( 'B' )" );
+ std::cout << "ZapLeadingChar( 'B' )" << s1.Str() << std::endl;
s1.ZapTrailingChar( 'Z' );
- s1.Dump( "ZapLeadingChar( 'Z' )" );
+ std::cout << "ZapLeadingChar( 'Z' ) - " << s1.Str() << std::endl;
s1 = "123";
s1.PadLeft( '0', 9 );
- s1.Dump( "s1.PadLeft('0', 9 ) ");
+ std::cout << "s1.PadLeft('0', 9 ) - " << s1.Str() << std::endl;
s1 = "abc";
s1.PadRight( 'Z', 9 );
- s1.Dump( "s1.PadRight('Z', 9 ) ");
+ std::cout << "s1.PadRight('Z', 9 ) " << s1.Str() << std::endl;
xbString sNullString;
if( sNullString.IsNull())