Note that (like all predicates that return a number as their last argument), this predicate can be used as a function inside arithmetic expressions.
Success:
      string_length("Peter ",X).  (gives X=6).
      string_length("Peter ",6).
      string_length("401.35",6).
Fail:
      string_length("Peter",6).
Error:
      string_length(Str,Len).            (Error 4).
      string_length(Str,6).              (Error 4).
      string_length("small",5.0).        (Error 5).
      string_length(Str,instantiated).   (Error 5).
      string_length(Str,46.2)            (Error 5).
      string_length('this one',L).       (Error 5).