# GB.NumberFromString

`int GB.NumberFromString ( int option , const char * str , long len , GB_VALUE * value );`

Reads a number inside a string and returns it in a `GB_VALUE` structure.

- option is a combination of the following constant :
  - GB_READ_INTEGER to read an integer.
  - GB_READ_FLOAT to read a floating point number.
  - GB_READ_BOTH to read both.
  - GB_READ_HEX_BIN to allow reading hexadecimal or binary values.
  - GB_NB_LOCAL to allow using localisation settings.
- str is the address of the string.
- len is its length.
- value points to a GB_VALUE structure.

This function returns a non-zero value if nothing could be read inside the specified string.

If the string contains an integer, the type field of the `GB_VALUE` structure is set to GB_T_INTEGER, and you can cast this structure to a GB_INTEGER to get the value.

If the string contains a floating point number, the type field of the `GB_VALUE` structure is set to GB_T_FLOAT, and you can cast this structure to a GB_FLOAT to get the value.