|
definition: |
string2urlencoded :: String -> String
string2urlencoded [] = []
string2urlencoded (c:cs)
| noEncode c = c : string2urlencoded cs
| c == ' ' = '+' : string2urlencoded cs
| otherwise
= let oc = ord c
in '%' : int2hex(oc `div` 16) : int2hex(oc `mod` 16) : string2urlencoded cs
where
noEncode x = isAlphaNum x || x `elem` "-"
int2hex i = if i<10 then chr (ord '0' + i)
else chr (ord 'A' + i - 10)
|
|
demand: |
argument 1 |
|
deterministic: |
deterministic operation |
|
documentation: |
Translates strings into equivalent URL encoded strings. See also <http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1>. |
|
failfree: |
_ |
|
indeterministic: |
referentially transparent operation |
|
infix: |
no fixity defined |
|
iotype: |
{({[]}) |-> {[]} || ({:}) |-> {:}}
|
|
name: |
string2urlencoded |
|
precedence: |
no precedence defined |
|
result-values: |
{:,[]}
|
|
signature: |
String -> String |
|
solution-complete: |
operation might suspend on free variables |
|
terminating: |
possibly non-terminating |
|
totally-defined: |
possibly non-reducible on same data term |