Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2025.0.0 - English


strcspn

lengths from the beginning of strings until a character among those prohibited

Syntax

res = strcspn(Strings, forbiddenChars)

Arguments

Strings

a character string or matrix of character strings.

forbiddenChars

a character string or matrix of character strings.

res

Matrix of positive real integers, of the size of Strings: lengths of the selected Strings heads.

Description

res = strcspn(Strings, forbiddenChars) scans Strings for the first occurrence of any of the characters that are part of forbiddenChars, returning the number of characters of Strings read before this first occurrence.

forbiddenChars must have same dimensions than Strings or forbiddenChars must be a string.

Examples

strcspn("fcba73", "1234567890")
strcspn(["fcba73", "f7cba73"], "1234567890")
strcspn(["fcba73", "f7cba73"], ["312", "34567890"])

See also

  • strspn — lengths of the beginning of strings as long as characters are among those allowed
Report an issue
<< strcmp Strings strindex >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Oct 24 11:13:10 CEST 2024