Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,5 @@
|
|||
fcn squeeze(c,str){ // Works with UTF-8
|
||||
s,cc,sz,n := Data(Void,str), String(c,c), c.len(), 0; // byte buffer in case of LOTs of deletes
|
||||
while(Void != (n=s.find(cc,n))){ str=s.del(n,sz) } // and searching is faster for big strings
|
||||
s.text
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
strings:=T(
|
||||
T("",""),
|
||||
T("-","\"If I were two-faced, would I be wearing this one?\" --- Abraham Lincoln "),
|
||||
T("7","..1111111111111111111111111111111111111111111111111111111111111117777888"),
|
||||
T(" ","I never give 'em hell, I just tell the truth, and they think it's hell. "),
|
||||
T(" "," --- Harry S Truman "),
|
||||
T("-"," --- Harry S Truman "),
|
||||
T("r"," --- Harry S Truman "),
|
||||
T("e","The better the 4-wheel drive, the further you'll be from help when ya get stuck!"),
|
||||
T("s","headmistressship"),
|
||||
T("\Ubd;","\Ubc;\Ubd;\Ubd;\Ube;"),
|
||||
);
|
||||
|
||||
foreach c,s in (strings){
|
||||
println("Squeeze: \"",c,"\"");
|
||||
println("Before: %2d <<<%s>>>".fmt(s.len(-8),s));
|
||||
sstr:=squeeze(c,s);
|
||||
println("After: %2d <<<%s>>>\n".fmt(sstr.len(-8),sstr));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue