---
title: "strval()"
canonical: "https://docs.xirgoglobal.com/space/SD/27144731/strval()"
format: markdown
---
### <span style="color: #36b37e">Description</span>

Convert from text (string) to numbers.

### <span style="color: #36b37e">Syntax</span>

`strval(string[], index);`

### <span style="color: #36b37e">Parameters</span>

| **Variable** | **Input** |
| --- | --- |
| `string[]` | The string containing a number in characters. This may be either a packed or unpacked string |
| `index` | The position in the string where to start looking for a number. This parameter allows to skip an initial part of a string, and extract numbers from the middle of a string |

NOTE: if string starts with 0x00, strval(string, *index*) will return 0 even when using *index *to skip those bytes. Workaround is strval(string[index]).

### <span style="color: #36b37e">Returns</span>

The value in the string, or zero if the string did not start with a valid number (starting at index).

### <span style="color: #36b37e">Function call example</span>

##### **Example of converting string to value**

```java
new array1[30]=''4, 8, 15, 14, 23, 42''; 
new val;
  
main(){  
  val = strval(array1, 3);  // result of val = 8;
  while(1){
    Delay(100);                                  
  }
}
```