updating oE value


include get.e 
namespace stdget 
public function value(sequence st, integer start_point = 1, integer answer = GET_SHORT_ANSWER) 

reads, from a string, a human-readable string of characters representing a Euphoria object. Converts the string into the numeric value of that object.

  1. st : a sequence, from which to read text
  2. offset : an integer, the position at which to start reading. Defaults to 1.
  3. answer : an integer, either GET_SHORT_ANSWER (the default) or GET_LONG_ANSWER.

A sequence, of length two (GET_SHORT_ANSWER) or four (GET_LONG_ANSWER) made of:

  • an integer, the return status. This is any of
    • GET_SUCCESS -- object was read successfully
    • GET_EOF -- end of file before object was read completely
    • GET_FAIL -- object is not syntactically correct
    • GET_NOTHING -- nothing was read, even a partial object string, before end of input
  • an object, the value that was read. This is valid only if return status is GET_SUCCESS.
  • an integer, the number of characters read. On an error, this is the point at which the error was detected.
  • an integer, the amount of initial whitespace read before the first active character was found

When answer is not specified, or explicitly GET_SHORT_ANSWER, only the first two elements in the returned sequence are actually returned.

This works the same as get but it reads from a string that you supply, rather than from a file or device.

After reading one valid representation of a Euphoria object value will stop reading and ignore any additional characters in the string. For example: "36" and "36P" will both give you {GET_SUCCESS, 36}.

The function returns {return_status, value} if the answer type is not passed or set to GET_SHORT_ANSWER. If set to GET_LONG_ANSWER, the number of characters read and the amount of leading whitespace are returned in 3rd and 4th position. The GET_NOTHING return status can occur only on a long answer.

Example 1:
s = value("12345"} 
s is {GET_SUCCESS, 12345} 
Example 2:
s = value("{0, 1, -99.9}") 
-- s is {GET_SUCCESS, {0, 1, -99.9}} 
Example 3:
s = value("+++") 
-- s is {GET_FAIL, 0} 
See Also:


Not Categorized, Please Help


Quick Links

User menu

Not signed in.

Misc Menu