# Translation Help

Hello everyone,

how can i translate this vom Pascal to Xojo?

```function IsDigit(C: Char): Boolean; begin Result := C in ['0'..'9']; // set of? How to do in Xojo? end;```

```function IsDigit(C As String) As Boolean Return C In 0 To 9 ? end function```

This should do it:

```Function isDigit(c as String) As Boolean return c<="9" and c>="0" End Function ```
You can also use the the built-in function isNumeric.

[quote=149149:@Jason King]This should do it:

```Function isDigit(c as String) As Boolean return c<="9" and c>="0" End Function ```
You can also use the the built-in function isNumeric.[/quote]
Thank you Jason, simple, to simple…its works ```Function IsDigit(s As String) As Boolean If IsNumeric(s) Then Dim i As Integer = CDbl(s) Return If(i >= 0 And i <= 9, True, False) Else Return False End If End Function```

[quote=149154:@Martin Trippensee]Thank you Jason, simple, to simple…its works ``````Function IsDigit(s As String) As Boolean
If IsNumeric(s) Then
Dim i As Integer = CDbl(s)
Return If(i >= 0 And i <= 9, True, False)
Else
Return False
End If
End Function``````

[/quote]
I wouldn’t count on this, unless you are 100% sure s will only ever be a single character.

I would not use IsNumeric as it forces a conversion to variant. Also CDbl may use localization.

Best may be to get ascii value of text and compare range.

```dim c as integer = asc(s) // 48 = 0 // 57 = 9 if c >= 48 and c <= 57 then return true end if```