string abc = "abc"; string ABC = abc.upper(); prin(abc.same(ABC)); print(abc.same("AXY")); print("$ABC $abc"); abc = ABC.lower(); print("$abc $ABC"); string ab = abc.fitLeft(2); string bc = abc.fitRight(2); print("'$ab' '$bc'"); string aL5 = abc.fitLeft(5); string aR5 = abc.fitRight(5); print("'$aL5' '$aR5'"); string bmw = "buggaMUGwugga"; print(bmw); print(bmw.first(5)); print(bmw.middle(5,3)); print(bmw.last(5)); print(bmw.rest(5)); int at = bmw.find('ugga'); print(bmw.rest(at)); at = bmw.findNext('ugga',at+1); print(bmw.rest(at)); if (bmw.startsWith("bug")) print("got starting bug"); if (bmw.startsWith("mug")) print("got starting mug"); if (bmw.endsWith("wugga")) print("got ending wugga"); if (bmw.endsWith("bloo")) print("got ending bloo"); string a1000 = "1000"; int i1000 = a1000.asInt(); print("$a1000 == $i1000?"); string aLong = "123456789123"; long iLong = aLong.asLong(); print("$aLong == $iLong?"); string aNum = "1.23e3"; double iNum = aNum.asDouble(); print("$aNum == $iNum?"); string space = "This is a string with \t tabs and spaces."; print(space); print(space.words()); print(space.tokens()); print(space.split(' ')); print(space.split(' \t')); string multiLine = " This is a multiline string here. "; prin(multiLine); print(multiLine.lines()); string leadSpace = " 123"; print("'$leadSpace' has " + leadSpace.leadingSpaces() + " leading spaces"); print("'$leadSpace' has " + leadSpace.leadingSpaces(1) + " leading spaces starting at 1"); leadSpace = " "; print("'$leadSpace' has " + leadSpace.leadingSpaces() + " leading spaces"); leadSpace = ""; print("'$leadSpace' has " + leadSpace.leadingSpaces() + " leading spaces"); leadSpace = "xyz"; print("'$leadSpace' has " + leadSpace.leadingSpaces() + " leading spaces"); string withQuotes = " 'This has a quote' inside of it"; print(withQuotes); int pos = withQuotes.leadingSpaces(); (string quoted, int newPos) = withQuotes.betweenQuotes(pos); print("'$quoted', $newPos"); print(withQuotes.rest(newPos)); withQuotes='""'; (quoted,newPos) = withQuotes.betweenQuotes(0); print("'$quoted', $newPos"); withQuotes = "'That\\\'s right.' More quotes."; print(withQuotes); (quoted,newPos) = withQuotes.betweenQuotes(0); print("'$quoted', $newPos"); print(withQuotes.rest(newPos)); withQuotes='""'; { string s = "This is my test string. How do you like it?"; print(s); string b = s.between("is my", "string"); print(b); b = s.between("How do", "This is"); print(b); int pos; (b,pos) = s.nextBetween("is my", "string", 3); print("match $b, pos $pos"); (b,pos) = s.nextBetween("is my", "string", 20); print("match $b, pos $pos"); (b,pos) = s.nextBetween("is my", "bugga", 0); print("match $b, pos $pos"); (b,pos) = s.nextBetween("This ", " my", 0); print("match $b, pos $pos"); (b,pos) = s.nextBetween(" my ", " string", pos); print("match $b, pos $pos"); string encoded = s.cgiEncode(); string decoded = encoded.cgiDecode(); print(s); print(encoded); print(decoded); } string path = "this/is/some/path"; int fPos = path.find('/'); int rPos = path.findLast('/'); print(path); print(path.rest(fPos)); print(path.rest(rPos));