
string_length(+String, -Length)

   Succeeds if Length is the length of the string String.



Arguments
   String              String.
   Length              Integer or variable.

Type
   Strings and Atoms

Description
   The length of the string String is unified with Length.


    Note that (like all predicates that return a number as their last
    argument), this predicate can be used as a function inside arithmetic
    expressions.


Modes and Determinism
   string_length(+, -) is det

Exceptions
     4 --- String is not instantiated (non-coroutine mode only).
     5 --- String is instantiated, but not to a string.
     5 --- Length is neither an integer nor a variable.

Examples
   
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).





See Also
   append_strings / 3, atom_length / 2, concat_strings / 3
