36#include "EST_String.h"
51EST_String eighth(
"some,words-with[punctuation]left..after,a-vowel!");
53EST_String quoted(
"\"some tokens\" which are \"quoted with \"\"\"");
55EST_String bits1[10], bits2[10], bits3[10], bits4[10], bits5[10], bits6[2];
71EST_Regex reg11(
"\\([^aeiou]\\)\\(\\]\\|[-[.,!?]\\)+");
94int test1 = first.contains(reg1);
95int test2 = first.contains(reg2);
96int test3 = first.contains(reg3);
97int test4 = first.contains(second);
98int test5 = fourth.contains(reg2);
99int test6 = fourth.contains(reg7);
100int test7 = first.contains(reg8);
101int test8 = fourth.contains(reg8);
102int test9 = first.contains(reg9);
103int test10 = fifth.contains(reg10);
104int test11 = first.contains(second,3);
105int test12 = first.contains(second,0);
106int test13 = second.contains(third, 0);
107int test14 = sixth.contains(seventh, 0);
108int test15 = seventh.contains(seventh, 0);
110int test0m = zeroth.matches(reg0);
111int test1m = first.matches(reg4);
112int test2m = second.matches(reg4);
113int test3m = first.matches(reg5);
124result8.
gsub(reg11,1);
127int num1 = split(first, bits1, 10, reg1);
128int num2 = split(first, bits2, 2, reg1);
129int num7 = split(first, bits3, 10, space);
130int num8 = split(quoted, bits4, 10, space,
'"');
131int num9 = split(quoted, bits5, 10, RXwhite,
'"');
132int num10 = split(first, bits6, 2,
".");
134int num3 = first.freq(
"o");
135int num4 = first.freq(third);
138int num5 = sub1.
gsub(
"l",
"[an ell]");
139int num6 = sub2.
gsub(reg1,
"[some ells]");
141cout <<
"First '"<< first <<
"'\n";
142cout <<
"Second '"<< second <<
"'\n";
143cout <<
"Third '"<< third <<
"'\n";
145cout <<
"Result 0 '"<< result0 <<
"'\n";
147cout <<
"Result 1 '"<< result1 <<
"'\n";
148cout <<
"Result 2 '"<< result2 <<
"'\n";
149cout <<
"Result 3 '"<< result3 <<
"'\n";
150cout <<
"Result 4 '"<< result4 <<
"'\n";
151cout <<
"Result 5 '"<< result5 <<
"'\n";
152cout <<
"Result 6b '"<< result6b <<
"'\n";
154cout <<
"Result 1a '"<< result1a <<
"'\n";
155cout <<
"Result 2a '"<< result2a <<
"'\n";
156cout <<
"Result 3a '"<< result3a <<
"'\n";
157cout <<
"Result 4a '"<< result4a <<
"'\n";
158cout <<
"Result 5a '"<< result5a <<
"'\n";
159cout <<
"Result 6a '"<< result6a <<
"'\n";
161cout <<
"Result 6 '"<< result6 <<
"'\n";
162cout <<
"Result 7 '"<< result7 <<
"'\n";
163cout <<
"Result 8 '"<< result8 <<
"'\n";
165cout <<
"Test 0 '"<< test0 <<
"'\n";
166cout <<
"Test 1 '"<< test1 <<
"'\n";
167cout <<
"Test 2 '"<< test2 <<
"'\n";
168cout <<
"Test 3 '"<< test3 <<
"'\n";
169cout <<
"Test 4 '"<< test4 <<
"'\n";
170cout <<
"Test 5 '"<< test5 <<
"'\n";
171cout <<
"Test 6 '"<< test6 <<
"'\n";
172cout <<
"Test 7 '"<< test7 <<
"'\n";
173cout <<
"Test 8 '"<< test8 <<
"'\n";
174cout <<
"Test 9 '"<< test9 <<
"'\n";
175cout <<
"Test 10 '"<< test10 <<
"'\n";
176cout <<
"Test 11 '"<< test11 <<
"'\n";
177cout <<
"Test 12 '"<< test12 <<
"'\n";
178cout <<
"Test 13 '"<< test13 <<
"'\n";
179cout <<
"Test 14 '"<< test14 <<
"'\n";
180cout <<
"Test 15 '"<< test15 <<
"'\n";
182cout <<
"Test 0m '"<< test0m <<
"'\n";
183cout <<
"Test 1m '"<< test1m <<
"'\n";
184cout <<
"Test 2m '"<< test2m <<
"'\n";
185cout <<
"Test 3m '"<< test3m <<
"'\n";
187cout <<
"Result 1r '"<< result1r <<
"'\n";
188cout <<
"Result 2r '"<< result2r <<
"'\n";
189cout <<
"Result 3r '"<< result3r <<
"'\n";
191cout <<
"Result 1at '"<< result1at <<
"'\n";
192cout <<
"Result 2at '"<< result2at <<
"'\n";
193cout <<
"Result 3at '"<< result3at <<
"'\n";
195cout <<
"Num 1 '"<< num1 <<
"'\n";
196cout <<
"bits1[0] '"<<bits1[0] <<
"'\n";
197cout <<
"bits1[1] '"<<bits1[1] <<
"'\n";
198cout <<
"bits1[2] '"<<bits1[2] <<
"'\n";
200cout <<
"Num 2 '"<< num2 <<
"'\n";
201cout <<
"bits2[0] '"<<bits2[0] <<
"'\n";
202cout <<
"bits2[1] '"<<bits2[1] <<
"'\n";
203cout <<
"bits2[2] '"<<bits2[2] <<
"'\n";
205cout <<
"Num 7 '"<< num7 <<
"'\n";
206cout <<
"bits3[0] '"<<bits3[0] <<
"'\n";
207cout <<
"bits3[1] '"<<bits3[1] <<
"'\n";
208cout <<
"bits3[2] '"<<bits3[2] <<
"'\n";
210cout <<
"Num 8 '"<< num8 <<
"'\n";
211cout <<
"bits4[0] '"<<bits4[0] <<
"'\n";
212cout <<
"bits4[1] '"<<bits4[1] <<
"'\n";
213cout <<
"bits4[2] '"<<bits4[2] <<
"'\n";
214cout <<
"bits4[3] '"<<bits4[3] <<
"'\n";
215cout <<
"bits4[4] '"<<bits4[4] <<
"'\n";
216cout <<
"bits4[5] '"<<bits4[5] <<
"'\n";
218cout <<
"Num 9 '"<< num9 <<
"'\n";
219cout <<
"bits5[0] '"<<bits5[0] <<
"'\n";
220cout <<
"bits5[1] '"<<bits5[1] <<
"'\n";
221cout <<
"bits5[2] '"<<bits5[2] <<
"'\n";
222cout <<
"bits5[3] '"<<bits5[3] <<
"'\n";
223cout <<
"bits5[4] '"<<bits5[4] <<
"'\n";
225cout <<
"Num 10 '"<< num10 <<
"'\n";
226cout <<
"bits6[0] '"<<bits6[0] <<
"'\n";
227cout <<
"bits6[1] '"<<bits6[1] <<
"'\n";
229cout <<
"Num 3 '"<< num3 <<
"'\n";
230cout <<
"Num 4 '"<< num4 <<
"'\n";
232cout <<
"Num 5 '"<< num5 <<
"'\n";
233cout <<
"Sub 1 '"<< sub1 <<
"'\n";
235cout <<
"Num 6 '"<< num6 <<
"'\n";
236cout <<
"Sub 1 '"<< sub2 <<
"'\n";
int gsub(const char *os, const EST_String &s)
Substitute one string for another.
EST_String before(int pos, int len=0) const
Part before position.
int contains(const char *s, int pos=-1) const
Does it contain this substring?