hmt-base-0.20: Haskell Music Theory Base
Safe HaskellSafe-Inferred
LanguageHaskell2010

Music.Theory.String

Description

String functions.

Synopsis

Documentation

str_eq_ci :: String -> String -> Bool Source #

Case-insensitive ==.

map (str_eq_ci "ci") (words "CI ci Ci cI")

filter_cr :: String -> String Source #

Remove r.

delete_trailing_whitespace :: String -> String Source #

Delete trailing Char where isSpace holds.

delete_trailing_whitespace "   str   " == "   str"
delete_trailing_whitespace "\t\n        \t\n" == ""

unwords_nil :: [String] -> String Source #

Variant of unwords that does not write spaces for NIL elements.

unwords_nil [] == ""
unwords_nil ["a"] == "a"
unwords_nil ["a",""] == "a"
unwords_nil ["a","b"] == "a b"
unwords_nil ["a","","b"] == "a b"
unwords_nil ["a","","","b"] == "a b"
unwords_nil ["a","b",""] == "a b"
unwords_nil ["a","b","",""] == "a b"
unwords_nil ["","a","b"] == "a b"
unwords_nil ["","","a","b"] == "a b"

unlines_nil :: [String] -> String Source #

Variant of unlines that does not write empty lines for NIL elements.

unlinesNoTrailingNewline :: [String] -> String Source #

unlines without a trailing newline.

unlines (words "a b c") == "a\nb\nc\n"
unlinesNoTrailingNewline (words "a b c") == "a\nb\nc"

capitalise :: String -> String Source #

Capitalise first character of word.

capitalise "freqShift" == "FreqShift"

unCapitalise :: String -> String Source #

Downcase first character of word.

unCapitalise "FreqShift" == "freqShift"

on_lines :: (String -> String) -> String -> String Source #

Apply function at each line of string.

on_lines reverse "ab\ncde\nfg" == "ba\nedc\ngf\n"