🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #19480

Re: Integer Decoding

#19480
From: Rich Wilkman
Date: Wed, 28 Jan 1998 00:00
63 lines
2653 bytes
David:

Since you are going for values here, I'm assuming that you are taking
your 3 "digit" value and adding numbers to the end.  You'll want to do
some pre-processing of the string value with the methods associated
with class String (the substring ones) to strip off all pre-ceeding
zero values.  Something like:

	get character
	if character != 0 copy it to a temp string
	else skip it and get the next character

This should result in a valid string that can be passed to create a
value.

-Rich

David Gordon wrote:
> 
> John,
> 
> I tried your suggestions and it worked perfectly.  Unfortunately, there is
> another "bug" in my code that I need some help with.  Shown below is the
> code fragement:
> 
>             ZipStringLow = new String(ZipCodeRangeLow);
>             Low = Low.decode(ZipStringLow);
>             ZipCodeLow = Low.intValue() * 100;
>             ZipCodeFile.read();
>             ZipCodeFile.read(ZipCodeRangeHigh);
>             ZipStringHigh = new String(ZipCodeRangeHigh);
>             High = High.decode(ZipStringHigh);
>             ZipCodeHigh = (High.intValue() * 100)+99;
> 
> I am reading 3 byte ASCII characters into a string.  I am then converting
> the string into a five digit integer.  This code works fine until it
> encounters a string of "060" and "069".  When it gets one of these strings I
> get the dreaded stack error.  Specifically,
> 
> java.lang.NumberFormatException: 69
> java.lang.Integer.parseInt
> java.lang.Integer.valueOf
> java.lang.decode.
> 
> Any help would be appreciated.  Thank you.
> 
> David

-- 

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Rich Wilkman
Senior Quality Assurance Engineer
Borland JBuilder Team

If you see something that looks like an opinion up there,
it's mine and mine alone.

Mail sent to me from the newsgroups won't bounce but will
be ignored.  If I have time, I'll respond, but you  have
a better chance if you confine your posts to the newsgroups
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Technical Details
Message-ID: <34CF6212.E5754238@corp.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <6ajane$rk210@forums.borland.com> <6alcfi$sd812@forums.borland.com> <6aluvj$sih10@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,405d87fec8049c8d
X-Google-Attributes: gidf74b3,public
From: Rich Wilkman <rwilkman@corp.borland.com>
Subject: Re: Integer Decoding
Date: 1998/01/28
Message-ID: <34CF6212.E5754238@corp.borland.com>
X-Deja-AN: 320003763
Content-Transfer-Encoding: 7bit
References: <6ajane$rk210@forums.borland.com> <6alcfi$sd812@forums.borland.com> <6aluvj$sih10@forums.borland.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Organization: None
Newsgroups: borland.public.jbuilder.java.language