Scilab-Branch-6.1-GIT
- Scilabヘルプ
- Strings
- ascii
- asciimat
- blanks
- char
- convstr
- emptystr
- evstr
- grep
- isalphanum
- isascii
- isdigit
- isletter
- isnum
- justify
- length
- part
- prettyprint
- regexp
- sci2exp
- strcat
- strchr
- strcmp
- strcspn
- strindex
- string
- stripblanks
- strncpy
- strrchr
- strrev
- strsplit
- strspn
- strstr
- strsubst
- strtod
- strtok
- tokenpos
- tokens
Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function
strspn
lengths of the beginning of texts as long as characters are among those allowed
呼び出し手順
headsLengths = strspn(Texts, allowedChars)
引数
- Texts, allowedChars, headsLengths
Matrices of texts, of identical dimensions.
allowedChars
can be a scalar string. It is then used for allTexts
components.
説明
headsLengths = strspn(Texts, allowedChars)
は,
allowedChars
に含まれる文字のみからなる
Texts
の先頭部分の長さを返します.
例
allowed = "0":"9" strspn("129th or the 130th", allowed) t = ["characters" "matrix" ; "text" "strings"] allowed = "a":"s" strspn(t, allowed) allowed = ["a":"j", "a":"u" ; "d":"u", "g":"v"] strspn(t, allowed)
--> allowed = "0":"9" allowed = "0123456789" --> strspn("129th or the 130th", allowed) ans = 3. --> t = ["characters" "matrix" ; "text" "strings"] t = "characters" "matrix" "text" "strings" --> allowed = "a":"s" allowed = "abcdefghijklmnopqrs" --> strspn(t, allowed) ans = 6. 2. 0. 1. --> allowed = ["a":"j", "a":"u" ; "d":"u", "g":"v"] allowed = "abcdefghij" "abcdefghijklmnopqrstu" "defghijklmnopqrstu" "ghijklmnopqrstuv" --> strspn(t, allowed) ans = 3. 5. 2. 7.
With UTF-8 extended characters:
t = "Να αμφιβάλλετε τα πάντα ή να μην αμφιβάλλετε τίποτα: " + .. "δύο ίσοι τρόποι αποφυγής σκέψης."; t = matrix(strsplit(t," "), 2,-1) allowed = "Ναβγδεϵζηθικλμνξοπρστυφϕχψωϐϑϰϱςϖ"; strspn(t, allowed)
--> t = matrix(strsplit(t," "), 2,-1) t = "Να" "τα" "ή" "μην" "τίποτα:" "ίσοι" "αποφυγής" "αμφιβάλλετε" "πάντα" "να" "αμφιβάλλετε" "δύο" "τρόποι" "σκέψης." --> allowed = "Ναβγδεϵζηθικλμνξοπρστυφϕχψωϐϑϰϱςϖ"; --> strspn(t, allowed) ans = 2. 2. 0. 3. 1. 0. 6. 5. 1. 2. 5. 1. 2. 2.
参照
Report an issue | ||
<< strsplit | Strings | strstr >> |