F# String to int conversion
23,887
Try built-in int
function.
let someString = "123"
let someInt = someString |> int // someInt now contains 123 int value
Related videos on Youtube
Author by
Anders Lassen
Crazy dank ass mad scientist trying to code some random stuff
Updated on September 14, 2020Comments
-
Anders Lassen over 3 years
How do i convert from string to int in F#?
As an example i'd like to pass
let someString = "123
tolet someInt = 123
I cant really find any parse methods that work for me.. This question is not about parsing from int to String, but string to int. Not duplicate of a related question. Any ideas?Thanks in advance
-
TeaDrivenDev over 7 yearsThe easiest way is to just use the
int
function. Apart from that, everything that works elsewhere in .NET is valid in F# as well, such asSystem.Int32.Parse()
. -
arash maleki over 7 yearsWhilst this question is definitely a duplicate, who picked the python question?
-