[program-java] Re: String to int...

  • From: "Corbett, James" <James.Corbett@xxxxxxxxxxxxx>
  • To: <program-java@xxxxxxxxxxxxx>
  • Date: Thu, 24 Sep 2009 15:48:06 -0400

JR:

Ya, the JNI can be nasty.... About a year ago I tried to connect to a VB6 
generated DLL with little to no success.... I eventually sought the words of a 
wise sage.... Mark Long.

Jim  

-----Original Message-----
From: program-java-bounce@xxxxxxxxxxxxx 
[mailto:program-java-bounce@xxxxxxxxxxxxx] On Behalf Of J. R. Westmoreland
Sent: September 24, 2009 15:01
To: program-java@xxxxxxxxxxxxx
Subject: [program-java] Re: String to int...

Jim,

The 1.5 and later versions of java have a facility like the C/C++ sprintf() 
function. You can allocate a buffer and just have it write them in there. I 
think with a format specifier like "%05d".

Your task is much easier than mine. LOL
You have to love that JNI stuff, right?

Best,
J. R.

-----Original Message-----
From: program-java-bounce@xxxxxxxxxxxxx
[mailto:program-java-bounce@xxxxxxxxxxxxx] On Behalf Of Corbett, James
Sent: Thursday, September 24, 2009 12:26 PM
To: program-java@xxxxxxxxxxxxx
Subject: [program-java] Re: String to int...

Adrian:

I'll take a look.

Jim  

-----Original Message-----
From: program-java-bounce@xxxxxxxxxxxxx
[mailto:program-java-bounce@xxxxxxxxxxxxx] On Behalf Of Adrian Beech
Sent: September 24, 2009 13:46
To: program-java@xxxxxxxxxxxxx
Subject: [program-java] Re: String to int...

G'day Jim,

 

If I understand your question you want the two byte representation of the 
integer value when the properties get method is called?  I'd suggest checking 
out the java.text classes and perhaps using, if I recall right, 
SimpleTextFormat.  I've done something similar in the past to display a numeric 
value as a literal which was padded out with leading 0's.

 

Cheers.

AB

 

From: program-java-bounce@xxxxxxxxxxxxx
[mailto:program-java-bounce@xxxxxxxxxxxxx] On Behalf Of Corbett, James
Sent: Thursday, 24 September 2009 11:06 PM
To: program-l@xxxxxxxxxxxxx; program-java@xxxxxxxxxxxxx
Subject: [program-java] String to int...

 

Sorry for the cross posting.... I have a COBOL copybook that defines an element 
as Pic 9(5)... 

In my Java class I need to pass into my setter an integer for obvious reasons. 
COBOL under the hood needs me to pass 00000 if the field is empty because I'm 
actually building the com area at this point. If however the field contains 999 
I must still pass 00999 to fulfil the expected length....

Ok, I have a string "00999" and need to convert it to an integer.... If I do 
so, then the leading zeros are stripped off and my com area is 2 bytes 
short.... Don't ask why or how it's the way it is....

So, how do I manage this? 

Jim 

James M. Corbett 

Programmer / Analyst
GST/HST Micros | Micros de la TPS/TVH
Business Suite Assessing Systems (BSAS) Revenue and Accounting Systems 
Directorate (RASD) | Direction des Systèmes de revenu et de comptabilité
(DSRC) Information Technology Branch (ITB) | Direction générale de 
l'informatique (DGI) Canada Revenue Agency | Agence du revenue du Canada 

(613) 941-1338 

"...Is a hippopotamus a hippopotamus, or just a really cool Opotamus?" 



__________ Information from ESET NOD32 Antivirus, version of virus signature 
database 4453 (20090924) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



__________ Information from ESET NOD32 Antivirus, version of virus signature 
database 4455 (20090924) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com





Other related posts: