English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Erlang String len Method

Erlang String

This method returns the length of a specific string.

Syntax

len(str)

Parameter

  • str −This is the string that needs to determine the number of characters.

Return Value

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

-module(helloworld). 
-import(string,[len/1]). 
-export([start/0]). 
start() -> 
   Str1 = "This is a string1" 
   Len1 = len(Str1), 
   io:fwrite("~p~n",[Len1]).

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

17

Erlang String