Repository navigation
Conversions
#185
Replies: 3 comments 3 replies
For Java, it requires the int result;
if (!result.TryParse("42"))
Console.WriteLine("Cannot parse");
Console.WriteLine(result);
I'll add this.
The reason is that file I/O is different in a browser and on Android than on desktop OSes. I couldn't design a consistent API. |
1 reply
|
Also with enums, would it be possible to use an enum inside of an interpolated string? Otherwise converting the enum to int then using the int in the interpolated string would work. |
1 reply
|
I see that C# will give the integer value of an enum if you use a :D format. |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
How can we convert a string to a number? I see tryparse is not supported in java.
Also is there a way to convert an enum to an integer? Having to write switches does not scale well for larger enums.
Otherwise I've tried using an abstract class for the user of the library to provide the functionality. I've also done that for File IO. But I can see File IO as out of scope.
All reactions