Mark N
February 18th, 1999, 03:02 AM
Hi to anyone reading this message.
I started learning and programming in Java a couple of days ago and I already have a problem. This is the kind of problem that is (probably) very easy to answer, and demonstrates my inexperience of Java, but here goes.
I am using Asymetrix Supercede Java Edition version 1.0 as my Java compiler (not my first choice, but it's all I have at the moment), and I needed to convert a string into an integer. I have found a solution by taking each character of the string and type casting it as an (int) and adding it to an integer variable (mulitplied by the position in the string (eg. if the string is "1234" the integer would be ( (int)('1')(*1000) + (int)('2')(*100) + (int)('3')(*10) + (int)('4') ) ) but this doesn't seem like a very efficient way of doing it. I have looked in the help files and there seems to be other ways to do it, but none seem to be accepted by the compiler. Can anyone give me any suggestions and examples????
Also, after some calculations, I need to convert the string back to an integer or long. The toInteger() and toLong() functions don't seem to work. Can someone offer help for this aswell????
Many thanks in advance for any help given.
I'm going to upgrade to Microsoft Visual J++ soon.
Mark.
Check out the FTR web page here
I started learning and programming in Java a couple of days ago and I already have a problem. This is the kind of problem that is (probably) very easy to answer, and demonstrates my inexperience of Java, but here goes.
I am using Asymetrix Supercede Java Edition version 1.0 as my Java compiler (not my first choice, but it's all I have at the moment), and I needed to convert a string into an integer. I have found a solution by taking each character of the string and type casting it as an (int) and adding it to an integer variable (mulitplied by the position in the string (eg. if the string is "1234" the integer would be ( (int)('1')(*1000) + (int)('2')(*100) + (int)('3')(*10) + (int)('4') ) ) but this doesn't seem like a very efficient way of doing it. I have looked in the help files and there seems to be other ways to do it, but none seem to be accepted by the compiler. Can anyone give me any suggestions and examples????
Also, after some calculations, I need to convert the string back to an integer or long. The toInteger() and toLong() functions don't seem to work. Can someone offer help for this aswell????
Many thanks in advance for any help given.
I'm going to upgrade to Microsoft Visual J++ soon.
Mark.
Check out the FTR web page here