Skip to main content

stringLength

Returns the length of the supplied string.

Signature​

stringLength(input: any): number

Parameters​

NameTypeOptionalDescription
inputanyNoSpecifies the string

Return value​

Returns the length of the string or 0 if the supplied variable is not a valid string or an empty string.

Example​

import { stringLength } from "@tripetto/builder";

stringLength("ABC"); // Returns `3`
stringLength(1); // Returns `0`