File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes conversion from c# to java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "conversion from c# to java" Watch "conversion from c# to java" New topic
Author

conversion from c# to java

Avi Sridhar
Ranch Hand

Joined: May 31, 2007
Posts: 42
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: 40052
    
  28
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
    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: 40052
        
      28
    Originally posted by Avi Sridhar:

    Thanks for the reply.

    Reg. this : Integer.parseInt(myString.substring( . . .

    did you mean

    Yes.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: conversion from c# to java