Erlang - len


Advertisements

The method returns the length of a particular string

Syntax

len(str)

Parameters

  • str − This is the string for which the number of characters need to be determined.

Return Value

The return value is the number of characters in the string.

For example

-module(helloworld). 
-import(string,[len/1]). 
-export([start/0]). 

start() -> 
   Str1 = "This is a string1", 
   Len1 = len(Str1), 
   io:fwrite("~p~n",[Len1]).

Output

When we run the above program, we will get the following result.

17
strings.htm
Advertisements