lambdabot- Lambdabot is a development tool and advanced IRC bot

Safe HaskellNone



String and other utilities



dropSpace :: [Char] -> [Char]Source

dropSpace takes as input a String and strips spaces from the prefix as well as the suffix of the String. Example:

 dropSpace "   abc  " ===> "abc"

dropSpaceEnd :: [Char] -> [Char]Source

Drop space from the end of the string



:: String

String to be broken

-> (String, String) 

Break a String into it's first word, and the rest of the string. Example:

 split_first_word "A fine day" ===> ("A", "fine day)

limitStr :: Int -> String -> StringSource

Truncate a string to the specified length, putting ellipses at the end if necessary.

listToStr :: String -> [String] -> StringSource

Form a list of terms using a single conjunction. Example:

 listToStr "and" ["a", "b", "c"] ===> "a, b and c"

showClean :: Show a => [a] -> StringSource

show a list without heavyweight formatting NB: assumes show instance outputs a quoted String. under that assumption, strips the outer quotes.

expandTab :: Int -> String -> StringSource

untab an string

io :: MonadIO m => IO a -> m aSource

random :: MonadIO m => [a] -> m aSource

Pick a random element of the list.