Text.XML.HXT.DOM.Util

hxt-9.3.1.22: A collection of tools for processing XML with Haskell.

Copyright | Copyright (C) 2008 Uwe Schmidt
License | MIT
Maintainer | Uwe Schmidt (uwe@fh-wedel.de)
Stability | stable
Portability | portable
Safe Haskell | Safe-Inferred
Language | Haskell2010

Text.XML.HXT.DOM.Util

Description

Little useful things for strings, lists and other values

Synopsis

- stringTrim :: String -> String
- stringToLower :: String -> String
- stringToUpper :: String -> String
- stringAll :: Eq a => [a] -> [a] -> [Int]
- stringFirst :: Eq a => [a] -> [a] -> Maybe Int
- stringLast :: Eq a => [a] -> [a] -> Maybe Int
- normalizeNumber :: String -> String
- normalizeWhitespace :: String -> String
- normalizeBlanks :: String -> String
- escapeURI :: String -> String
- textEscapeXml :: String -> String
- stringEscapeXml :: String -> String
- attrEscapeXml :: String -> String
- stringToInt :: Int -> String -> Int
- stringToHexString :: String -> String
- charToHexString :: Char -> String
- intToHexString :: Int -> String
- hexStringToInt :: String -> Int
- decimalStringToInt :: String -> Int
- doubles :: Eq a => [a] -> [a]
- singles :: Eq a => [a] -> [a]
- noDoubles :: Eq a => [a] -> [a]
- swap :: (a, b) -> (b, a)
- partitionEither :: [Either a b] -> ([a], [b])
- toMaybe :: Bool -> a -> Maybe a
- uncurry3 :: (a -> b -> c -> d) -> (a, b, c) -> d
- uncurry4 :: (a -> b -> c -> d -> e) -> (a, b, c, d) -> e

# Documentation

stringTrim :: String -> String #

remove leading and trailing whitespace with standard Haskell predicate isSpace

stringToLower :: String -> String #

convert string to lowercase with standard Haskell toLower function

stringToUpper :: String -> String #

convert string to uppercase with standard Haskell toUpper function

stringAll :: Eq a => [a] -> [a] -> [Int] #

find all positions where a string occurs within another string

stringFirst :: Eq a => [a] -> [a] -> Maybe Int #

find the position of the first occurence of a string

stringLast :: Eq a => [a] -> [a] -> Maybe Int #

find the position of the last occurence of a string

normalizeNumber :: String -> String #

Removes leading / trailing whitespaces and leading zeros

normalizeWhitespace :: String -> String #

Reduce whitespace sequences to a single whitespace

normalizeBlanks :: String -> String #

replace all whitespace chars by blanks

escapeURI :: String -> String #

Escape all disallowed characters in URI references (see http://www.w3.org/TR/xlink/#link-locators)

textEscapeXml :: String -> String #

escape XML chars &lt; and ampercent by transforming them into character references, used for escaping text nodes

see also : `attrEscapeXml`

stringEscapeXml :: String -> String #

escape XML chars &lt;, &gt;, &quot;, and ampercent by transforming them into character references

see also : `attrEscapeXml`

attrEscapeXml :: String -> String #

escape XML chars in attribute values, same as stringEscapeXml, but none blank whitespace is also escaped

see also : `stringEscapeXml`

stringToInt :: Int -> String -> Int #

stringToHexString :: String -> String #

convert a string into a hexadecimal string applying charToHexString

see also : `charToHexString`

charToHexString :: Char -> String #

convert a char (byte) into a 2-digit hexadecimal string

see also : `stringToHexString`, `intToHexString`

intToHexString :: Int -> String #

convert a none negative Int into a hexadecimal string

see also : `charToHexString`

hexStringToInt :: String -> Int #

convert a string of hexadecimal digits into an Int

decimalStringToInt :: String -> Int #

convert a string of digits into an Int

doubles :: Eq a => [a] -> [a] #

take all elements of a list which occur more than once. The result does not contain doubles. (doubles . doubles == doubles)

singles :: Eq a => [a] -> [a] #

drop all elements from a list which occur more than once.

noDoubles :: Eq a => [a] -> [a] #

remove duplicates from list

swap :: (a, b) -> (b, a) #

partitionEither :: [Either a b] -> ([a], [b]) #

toMaybe :: Bool -> a -> Maybe a #

uncurry3 :: (a -> b -> c -> d) -> (a, b, c) -> d #

mothers little helpers for to much curry

uncurry4 :: (a -> b -> c -> d -> e) -> (a, b, c, d) -> e #