/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. open Swig
  3. open Example
  4. let y = "\205\177"
  5. let z = _to_wstring_with_locale '((y to string),(Sys.argv.(1) to string))
  6. let _ =
  7. begin
  8. print_string "the original string contains " ;
  9. print_int (String.length y) ;
  10. print_newline () ;
  11. print_string "the new string contains " ;
  12. print_int (z -> size () as int) ;
  13. print_string " : [ " ;
  14. for i = 0 to (pred ((z -> size ()) as int)) do
  15. print_int ((z '[i to int]) as int) ;
  16. print_string "; " ;
  17. done ;
  18. print_string "]" ;
  19. print_newline () ;
  20. end