Please enable JavaScript to view this site.

Knowledge Base

Navigation: Scripting Language > Functions

str2num

We've made some changes. Use 'Ctrl-F5' to clear your browser cache.
Scroll Prev Top Next More

Converts a string into a floating point number. Use the format script command to change the precision of the output.

 

Supported Product: FDTD, MODE, DEVICE, INTERCONNECT

 

Syntax

Description

out = str2num(string);

Converts string into a number.

 

Example

Convert a string into a number.

?str2num("1+2");

3

 

Compare the output using almostequal.

?almostequal(str2num("1.5677"), 1.5677);

result: 

1  

 

See Also

Operators, ", +, ?, endl, write, format, findstring, replace, replacestring, substring, lower, upper, toscript, almostequal

Copyright Lumerical Inc. | Privacy | Site Map