let c = 'A';;


Strings act like an array of characters:

let str1 = "Hello world";;
let str2 = String.make 5 'A';;

The same way you get an array length, you can get it for a string:

let str1 = "Hello world";;
let len = String.length str1;; (* len = 11 *)

Get a character in a string

It works like arrays, but using [] instead of ():

let str1 = "Hello world!";;
let c = str1.[3];; (* c = 'o' *)

String concatenation

You can concatenate strings using the ^ operator:

let name = "Nathan" in
let hello = "Hello " ^ name in
print_endline hello;;