Functions Index :: Q :: QuoteNoexpr

[<< up one level]

Module:

string :: core

Definition:

QuoteNoexpr(string x)

Description:

Returns its argument string either quoted if it fails to evaluate (and thus it is not a valid expression or global identifier's name) or unchanged if it succeeds to evaluate.

Its intended usage is constructing proper strings for passing to Eval() but be aware of possible side effects if its argument contains an exression or a function that assigns to globals and not just a variable name.

This function is used by the array package.

Examples:

global nb_exp = 2

s = QuoteNoexpr("nb_exp") # s == 'nb_exp'

t = QuoteNoexpr("nbnoexp") # t == '"nbnoexp"'

 

[<< top]