nchar

nchar(x)

Count the number of characters in text

Parameters

Name Type Description Default
x Union[str, List[str]] A str or a list of str required

Returns

Name Type Description
Union[int, List[int]] if x is a str, an integer with the number of characters in x, if x is a list a list of these integers with the number of characters in each element of x

Examples

>>> from rlike import *
>>> nchar('Hello World')
11
>>> nchar(['Hello World', 'How are you?'])
[11, 12]