Skip to the content
Documentation

count_chars

No ratings yet

Summary

Returns the length of the input string.

Usage

input|count_chars()

Returns

An integer revealing the string length.

Description

This operator counts and returns the number of characters (all of them, whitespaces included) that make up the input string.

Examples

Example 1
{'Testing 1 2 3'|count_chars()}

The following output will be returned: "13".

Example 2
{'Testing'|count_chars()}

The following output will be returned: "7".

Contributors

Comments (2 historical)

Written by readers of the earlier documentation sites, kept as they were.

  1. Passing the string as an argument

    Tristan Rivoallan ·

    Passing the string as an argument doesn't work (ie. function returns nothing). Why ?
    I doesn't seem like this behavior is the same among all operators.

    1. Re: Passing the string as an argument

      Meinhard Benn ·

      use count() instead:

      {count('hello world')}

Comments

Add a comment

Comments are read by a moderator before they appear.