| File doc/godi-frontc/html/code_VALCxml.escape_attr.html | GODI Package godi-frontc |
| code_VALCxml.escape_attr.html |
let escape_attr text quote =
let buf = Buffer.create 32 in
let rec perform i =
if i >= String.length text then Buffer.contents buf else
begin
(match String.get text i with
'&'
-> Buffer.add_string buf "&"
| '<'
-> Buffer.add_string buf "<"
| c when c = quote
-> Buffer.add_string buf
(if quote = '"' then ""e;" else "'")
| c
-> Buffer.add_char buf c);
perform (i + 1)
end in
perform 0