File:  [CSRG BSD Unix] / 43BSD / contrib / icon / src / lib / strutil.icn
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:55 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43
BSD 4.3

#	STRUTIL(2)
#
#	String utilities
#
#	Ralph E. Griswold
#
#	Last modified 7/10/83
#

#  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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.