Module

Data.String.Yarn

Package
purescript-yarn
Repository
thimoteus/purescript-yarn

#TagString Source

newtype TagString (a :: Row Type)

A generic String tagged by a row of data types

Instances

#runTag Source

runTag :: forall a. TagString a -> String

Turn a TagString into a String

#tag Source

tag :: forall a. String -> TagString a

Turn a String into a TagString

#fromChars Source

fromChars :: forall f. Foldable f => f Char -> String

Turn a Foldable container of Chars to a String

#toChars Source

toChars :: forall f. Unfoldable f => String -> f Char

Turn a String into an Unfoldable container of Chars. For example:

toChars "Foo" == ['F','o','o'] :: Array Char

#cons Source

cons :: Char -> String -> String

Attach a Char to the front of a String

#(:) Source

Operator alias for Data.String.Yarn.cons (right-associative / precedence 5)

#snoc Source

snoc :: String -> Char -> String

Attach a Char to the end of a String

#range Source

range :: Int -> Int -> Maybe String

Create a String containing a range of Chars, inclusive

#(..) Source

Operator alias for Data.String.Yarn.range (non-associative / precedence 8)

#unsafeRange Source

#head Source

head :: String -> Maybe Char

Safely get the first Char in a String

#last Source

last :: String -> Maybe Char

Safely get the last Char in a `String

#tail Source

tail :: String -> Maybe String

Safely get all but the first Char in a String

#init Source

init :: String -> Maybe String

Safely get all but the last Char in a String

#index Source

index :: String -> Int -> Maybe Char

Safely get the Char at a given index of a String

#(!!) Source

Operator alias for Data.String.Yarn.index (left-associative / precedence 8)

#lines Source

lines :: String -> Array String

Split a String by its newlines

#unlines Source

unlines :: Array String -> String

Join an Array of Strings with newlines

#words Source

words :: String -> Array String

Split a String by its spaces

#unwords Source

unwords :: Array String -> String

Join an Array of Strings with spaces

#substitute Source

substitute :: Pattern -> Replacement -> String -> String

Like replace but acts globally

#substituteMany Source

substituteMany :: forall f. Foldable f => f (Tuple Pattern Replacement) -> String -> String

Replace many substitutions given some association list

#capitalize Source

capitalize :: String -> String

Capitalize the first Char in a String

#capWords Source

capWords :: String -> String

Capitalize the first Char in each word of a given String

#rightpad Source

rightpad :: String -> String

Append a space to the right of a String

#rightpadBy Source

rightpadBy :: Int -> String -> String

Append a given number of spaces to the right of a String

#leftpad Source

leftpad :: String -> String

Append a space to the left of a String

#leftpadBy Source

leftpadBy :: Int -> String -> String

Append a given number of spaces to the left of a String

#reverse Source

reverse :: String -> String

Reverse a String, may give funky results with unicode

#replicate Source

replicate :: Int -> Char -> String

Replicate a Char a given number of times

#charMap Source

charMap :: (Char -> Char) -> String -> String

Transform a function on Chars to a function on Strings

#charTraverse Source

charTraverse :: forall m. Applicative m => (Char -> m Char) -> String -> m String

Transform a Kleisli arrow on Chars to one on Strings

#charFold Source

charFold :: (String -> Char -> String) -> String -> String -> String

Fold over a String with a function that takes an accumulator String and next Char as input

#rot13 Source

rot13 :: String -> String

Cresbezf n ebg13 fhofgvghgvba ba n Fgevat