Author
conversion from c# to java
Avi Sridhar
Ranch Hand
Joined: May 31, 2007
Posts: 42
posted Jul 10, 2008 09:16:00
0
Hello All, Thanks for helping me out with answers here. I have one more question regarding conversion of c# into java . Is this the right way to do this . I see there is something wrong. Please let me know. Thanks
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32694
Hardly a beginner's topic! No, it is not the right way to do it. If you take the value of a char, you might get 'A' = 0x41 (65). You could try several things: Integer.parseInt(myString.substring( . . . Character#getNumericValue charAt() - '0' and there are bound to be others. At least the parsing methods will throw a nice Exception if your char isn't a number!
Avi Sridhar
Ranch Hand
Joined: May 31, 2007
Posts: 42
posted Jul 10, 2008 09:41:00
0
Originally posted by Campbell Ritchie:
Hardly a beginner's topic!
No, it is not the right way to do it. If you take the value of a char, you might get 'A' = 0x41 (65). You could try several things:
Integer.parseInt(myString.substring( . . . Character#getNumericValue charAt() - '0' and there are bound to be others. At least the parsing methods will throw a nice Exception if your char isn't a number!
Thanks for the reply. Reg. this : Integer.parseInt(myString.substring( . . . did you mean
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32694
Originally posted by Avi Sridhar: Thanks for the reply. Reg. this : Integer.parseInt(myString.substring( . . . did you mean
Yes.
subject: conversion from c# to java