- Joined
- Jan 2, 2020
- Messages
- 1,284
So my question was supposed to a simple one about how you would prefer to check wether a string contains a number or not.
But as I moved from macos to the Linux platform this question changed a bit. because I get a different behaviour here.
Int() with non-numbers on macOS will return NaN, while Linux will return 0.
So they handle this differently, is this expected or a bug?
Back to the question, how would you prefer dealing with checking that a string is indeed not a number but something else in Cerberus?
test.cxs
testdata.txt
But as I moved from macos to the Linux platform this question changed a bit. because I get a different behaviour here.
Int() with non-numbers on macOS will return NaN, while Linux will return 0.
So they handle this differently, is this expected or a bug?
Back to the question, how would you prefer dealing with checking that a string is indeed not a number but something else in Cerberus?
test.cxs
Code:
Import mojo.app
Function Main:Int()
Local lines:String[] =LoadString("testdata.txt").Split("~n")
For Local line:String = Eachin lines
Local items:String[] = line.Split(",")
For Local item:= Eachin items
Print Int(item) ' Will print "Nan" on macos and "0" on Linux
Print item
Next
Next
Return 0
End
testdata.txt
Code:
1,2,3,4,5,6,7,8
121,3453245,6564,3224234
987978,CerberusX,4356346
Last edited: