Aller au contenu principal

Count_chars

Return information about characters used in a string.

COUNT_CHARS

NAME

Count_chars - Returns information about characters used in a string.

SYNOPSIS

Count_chars(string,asstr)

PARAMETERS

string
The input string. To use this function, one has to define an input that will be analyzed. asstr If you put "true" as asstr, it returns the value as a string instead of a context. If you put nothing, it returns the frequency of every byte as value. This is optional.
asstr
If you put "true" as asstr, it returns the value as a string instead of as a context. If you put nothing, it returns the frequency of every byte as value. This is optional.

RETURN

Array
It returns an array with the byte-value as key and the frequency of every byte as value. This means that it will show you how many times a character is written in the input. It will also return a string containing all unique characters, depending on what you put as asstr.

EXAMPLES

in:  res={{count_chars("helloòó worldòó")}}.
out: res={" ":1,"r":1,"d":1,"e":1,"ò":2,"ó":2,"w":1,"h":1,"l":3,"o":2}.

in:  res={{count_chars("helloòó worldòó",true)}}.
out: res=heloòó wrd.

SEE ALSO

{{ include("includes/strings.sn") }}

AUTHOR

Written by Pusnei Sergey and Caroline Laplante, <sergey@sednove.com>

MODIFICATIONS

1.0 2014-09-09 21:24:14 laplante@sednove.com

Edit

© 2022 extenso Inc. All rights reserved.