Product Documentation
Cadence SKILL Language Reference
Product Version IC23.1, November 2023

readstring

readstring( 
t_string 
) 
=> g_result / nil 

Description

Returns the first expression in a string. Subsequent expressions in the string are ignored. The expression is not processed in any way.

Arguments

t_string

String to read.

Value Returned

g_result

The object read in.

nil

When the port is at the end of the string.

Examples

The following example shows normal operation.

readstring("fun( 1 2 3 ) fun( 4 5 )") => ( fun 1 2 3 )

The following example shows the error message if the string contains a syntax error.

readstring("fun(" )
fun(
^
SYNTAX ERROR found at line 1 column 4 of file *string*
*Error* lineread/read: syntax error encountered in input
*WARNING* (include/load): expression was improperly terminated.

The following example illustrates that readstring applied to the print representation of an expression, returns the expression.

EXPRESSION = 'list( 1 2 ) 
=> list(1 2)
EXPRESSION == readstring( sprintf( nil "%L" EXPRESSION ))
=> t

Related Topics

String Functions

linereadstring


Return to top
 ⠀
X