/trunk/Examples/ocaml/std_string/runme.ml
OCaml | 24 lines | 19 code | 4 blank | 1 comment | 1 complexity | 66f2e5eba0962e156fab8a56c2977b3a MD5 | raw file
1(* This example was mostly lifted from the guile example directory *) 2 3open Swig 4open Example 5 6let y = "\205\177" 7let z = _to_wstring_with_locale '((y to string),(Sys.argv.(1) to string)) 8 9let _ = 10 begin 11 print_string "the original string contains " ; 12 print_int (String.length y) ; 13 print_newline () ; 14 15 print_string "the new string contains " ; 16 print_int (z -> size () as int) ; 17 print_string " : [ " ; 18 for i = 0 to (pred ((z -> size ()) as int)) do 19 print_int ((z '[i to int]) as int) ; 20 print_string "; " ; 21 done ; 22 print_string "]" ; 23 print_newline () ; 24 end