Scilab 6.1.0
      
      - 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
- strings
- stripblanks
- strncpy
- strrchr
- strrev
- strsplit
- strspn
- strstr
- strsubst
- strtod
- strtok
- tokenpos
- tokens
Please note that the recommended version of Scilab is 2026.0.0. This page might be outdated.
See the recommended documentation of this function
strtod
parse and convert literal numbers STRings TO Decimal numbers
Syntax
d = strtod(str [,decimalseparator]) [d, tails] = strtod(str [,decimalseparator])
Arguments
- str
- single component, vector, or matrix of text (strings). 
- decimalseparator
- the decimal separator chosen: "." (by default) or ",". 
- d
- scalar, vector, or matrix of decimal numbers. 
- tails
- a string or matrix of strings: remaining parts of - strafter the numerical heads (if any).
Description
[d, tails] = strtod(str) parses each string of
            str and tries to interpret its content as a decimal
            number:
            
- If it succeeds, at least for the heading part of
                    str(i), the corresponding decimal number is returned ind(i). If any, the trailing part ofstr(i)is ignored and returned intails(i); otherwise,tails(i)returns "".
- Otherwise, d(i)returns%nan, andtails(i)is the wholestr(i).
|  | 
 | 
Examples
s = ["123.556 abc " ".543" "#58B" "0x73 " "%inf" "-1.47e-71" "67,432.57" " 23,5" "-,57" "Inf" ] [num, trail] = strtod(s); num, "/"+trail+"/" // With "," as decimal separator: [num, trail] = strtod(s, ","); num, "/"+trail+"/"
See also
History
| Version | Description | 
| 5.5.0 | Option decimalseparator introduced (SEP 97). | 
| 5.4.1 | If strdoes not contain any numerical value,dnow returnsNaninstead of0. | 
| Report an issue | ||
| << strsubst | Strings | strtok >> |