murex Shell Docs

Command Reference: len

Outputs the length of an array

Description

This will read an array from STDIN and outputs the length for that array

Usage

<STDIN> -> len -> <stdout>

Examples

» tout: json (["a", "b", "c"]) -> len 
3

Detail

Please note that this returns the length of the array rather than string. For example out "foobar" -> len would return 1 because an array in the str data type would be new line separated (eg out "foo\nbar" -> len would return 2). If you need to count characters in a string and are running POSIX (eg Linux / BSD / OSX) then it is recommended to use wc instead. But be mindful that wc will also count new line characters

» out: "foobar" -> len
1

» out: "foo\nbar" -> len
2

» out: "foobar" -> wc: -c
7

» out: "foo\nbar" -> wc: -c
8

» printf: "foobar" -> wc: -c
6
# (printf does not print a trailing new line)

See Also

This site is rebuilt weekly, the content is automatically generated from murex's source code. Last built on Mon Sep 21 06:11:30 UTC 2020 against commit 2557f7c2557f7cc7535c452c21d89164bd38ed8996f02fd. Downloadable murex binaries are also built weekly. Current version is 0.52.2000 BETA which has been verified against tests.