Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/system/Basis/Implementation/string.sml
ViewVC logotype

Diff of /sml/trunk/src/system/Basis/Implementation/string.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

sml/branches/SMLNJ/src/system/Basis/Implementation/string.sml revision 498, Tue Dec 7 15:44:50 1999 UTC sml/trunk/src/system/Basis/Implementation/string.sml revision 1155, Wed Mar 20 20:52:51 2002 UTC
# Line 127  Line 127 
127            (* end case *)            (* end case *)
128          end (* concat *)          end (* concat *)
129    
130      (* concatenate a list of strings, using the given separator string *)
131        fun concatWith _ [] = ""
132          | concatWith _ [x] = x
133          | concatWith sep (h :: t) =
134            concat (rev (foldl (fn (x, l) => x :: sep :: l) [h] t, []))
135    
136    (* implode a list of characters into a string *)    (* implode a list of characters into a string *)
137      fun implode [] = ""      fun implode [] = ""
138        | implode cl =  let        | implode cl =  let
# Line 194  Line 200 
200    
201    (* String comparisons *)    (* String comparisons *)
202      fun isPrefix s1 s2 = PreString.isPrefix (s1, s2, 0, size s2)      fun isPrefix s1 s2 = PreString.isPrefix (s1, s2, 0, size s2)
203      fun compare (a, b) = PreString.cmp (a, 0, size a, b, 0, size b)      fun isSuffix s1 s2 =
204      fun collate cmpFn (a, b) = PreString.collate cmpFn (a, 0, size a, b, 0, size b)          let val sz2 = size s2
205            in
206                PreString.isPrefix (s1, s2, sz2 - size s1, sz2)
207            end
208        fun isSubstring s = let
209            val stringsearch = PreString.kmp s
210            fun search s' = stringsearch (s', 0, size s') >= 0
211        in
212            search
213        end
214    
215        fun compare (a, b) =
216            PreString.cmp (a, 0, size a, b, 0, size b)
217        fun collate cmpFn (a, b) =
218            PreString.collate cmpFn (a, 0, size a, b, 0, size b)
219    
220    (* String greater or equal *)    (* String greater or equal *)
221      fun sgtr (a, b) = let      fun sgtr (a, b) = let

Legend:
Removed from v.498  
changed lines
  Added in v.1155

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0