# STRUTIL # # Miscellaneous string utilities # # Ralph E. Griswold # # Last modified 12/15/85 # # compress characters # procedure compress(s,c) local i i := 0 while i := upto(c,s,i + 1) do s := s[1:i + 1] || s[many(s[i],s,i):0] return s end # delete characters # procedure delete(s,c) local i while i := upto(c,s) do s[i:many(c,s,i)] := "" return s end # rotate string # procedure rotate(s,i) /i := 1 if i <= 0 then i +:= *s i %:= *s return s[i + 1:0] || s[1:i + 1] end