break (== c) l == breakSubstring (singleton c) lFor example, to tokenise a string, dropping delimiters:
tokenise x y = h : if null t then [] else tokenise x (drop (length x) t) where (h,t) = breakSubstring x yTo skip to the first occurrence of a string:
snd (breakSubstring x y)To take the parts of a string before a delimiter:
fst (breakSubstring x y)Note that calling `breakSubstring x` does some preprocessing work, so you should avoid unnecessarily duplicating breakSubstring calls with the same pattern.
break (== c) l == breakSubstring (singleton c) lFor example, to tokenise a string, dropping delimiters:
tokenise x y = h : if null t then [] else tokenise x (drop (length x) t) where (h,t) = breakSubstring x yTo skip to the first occurrence of a string:
snd (breakSubstring x y)To take the parts of a string before a delimiter:
fst (breakSubstring x y)Note that calling `breakSubstring x` does some preprocessing work, so you should avoid unnecessarily duplicating breakSubstring calls with the same pattern.
break (== c) l == breakSubstring (singleton c) lFor example, to tokenise a string, dropping delimiters:
tokenise x y = h : if null t then [] else tokenise x (drop (length x) t) where (h,t) = breakSubstring x yTo skip to the first occurrence of a string:
snd (breakSubstring x y)To take the parts of a string before a delimiter:
fst (breakSubstring x y)Note that calling `breakSubstring x` does some preprocessing work, so you should avoid unnecessarily duplicating breakSubstring calls with the same pattern.
break (== c) l == breakSubstring (singleton c) lFor example, to tokenise a string, dropping delimiters:
tokenise x y = h : if null t then [] else tokenise x (drop (length x) t) where (h,t) = breakSubstring x yTo skip to the first occurrence of a string:
snd (breakSubstring x y)To take the parts of a string before a delimiter:
fst (breakSubstring x y)Note that calling `breakSubstring x` does some preprocessing work, so you should avoid unnecessarily duplicating breakSubstring calls with the same pattern.