3 stupid test program to verify stringlib
9 #include "string-convert.hh"
14 cout << "constructors"<<endl;
20 String fromf(1.32e-2, "%g");
37 a.sort(String::compare_i);
38 cout << "compares: "<<endl;
39 for (int i=0; i < a.size(); i++)
47 String hay = "foobarbazblub";
52 cout << "hay = \"" << hay << "\" len="<< hay.length_i()<<endl;
53 cout << "index_i('"<< c<<"') " << c << "= " << hay.index_i(c) <<endl;
54 cout << "last_index_i('"<< c<<"') " << c << "= " << hay.index_last_i(c) <<endl;
55 // cout << "last index of cstr " << c << ": " << hay.index_last_i(cstr) <<endl;
56 // cout << "index_last_i(\""<<set<<"\"): " << hay.index_last_i(set) <<endl;
57 cout << "index_i(\""<<set<<"\"): " << hay.index_i(set) <<endl;
58 cout << "index_any(\"" << set << "\"): " << cstr << ": " << hay.index_any_i(cstr) <<endl;
69 for (int i=-1; i < str.length_i()+2; i++) {
70 cout<<" left_str(" << i<<"): " << str.left_str( i ) << endl;
71 cout<<" right_str( "<<i<<"): " << str.right_str( i ) << endl;
75 cout << "mid(2,6)="<<str.mid_str(2,6)<<endl;
76 cout << "nomid(2,6)="<<str.nomid_str(2,6)<<endl;
80 test_empty_b( String str )
82 cout << "`" << str << "' is ";
84 if ( str == String( "" ) ) {
85 cout << "empty" << endl;
89 cout << "not empty" << endl;
102 cout << "left" << endl;
106 // str = String( "Hallo" ) + " daaR" + '!'; // no go on doze-s gcc2.7.2?
107 str = String( "Hallo" ) + " daaR" + "!";
110 cout << "up: " << str.upper_str() << " down: " << str.lower_str()<<endl;
112 if ( test_empty_b( str ) )
116 if ( !test_empty_b( fn ) )
121 delete fn.copy_byte_p();
122 delete str.copy_byte_p();
124 cout << String_convert::bin2hex_str( String( (char)0xff ) ) << endl;
125 cout << "-1:" << String_convert::i2hex_str( -1, 2, '0' );