Docs GODI Archive
Projects Blog Link DB

Search GODI:


More options
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 "&lt;"
                        | c when c = quote
                                -> Buffer.add_string buf
                                        (if quote = '"' then "&quote;" else "&apos;")
                        | c
                                -> Buffer.add_char buf c);
                        perform (i + 1)
                end in
        perform 0
This web site is published by Informatikbüro Gerd Stolpmann
Powered by Caml