instance Read String where
read str = str
+@deprecated "Instead of 'splitString text pattern', write 'split pattern text' (note change in the parameter order)."
"`splitString text pattern` splits the string into a list of string where the parts are sepratated in the original list by the given pattern."
splitString :: String -> String -> [String]
splitString source pattern = arrayToList $ splitString_ source pattern
joinWithSeparator separator values = runProc (
StringBuilder.toString $ printWithSeparator StringBuilder.new separator values)
+
+intercalate :: String -> [String] -> String
+intercalate separator strings = do
+ l = length strings
+ if l == 0
+ then ""
+ else if l == 1
+ then strings!0
+ else runProc do
+ sb = StringBuilder.new
+ sb << strings!0
+ loop i | i == l = ()
+ | otherwise = do
+ sb << separator << strings!i
+ loop (i+1)
+ loop 1
+ StringBuilder.toString sb
+
instance (Show a) => Show [a] where
sb <+ l = do
len = length l