java reading numbers, interpreting as octal, want interpreted as string
Posted
by user331401
on Stack Overflow
See other posts from Stack Overflow
or by user331401
Published on 2010-05-03T12:34:52Z
Indexed on
2010/05/03
12:38 UTC
Read the original article
Hit count: 358
hello, i am having an issue, where java is reading an array list from a YAML file of numbers, or strings, and it is interpreting the numbers as octal if it has a leading 0, and no 8-9 digit.
is there a way to force java to read the yaml field as a string?
code:
ArrayList recordrarray = (ArrayList) sect.get("recordnum");
if (recordrarray != null) {
recno = join (recordrarray, " ");
}
HAVE ALSO TRIED:
Iterator<String> iter = recordrarray.iterator();
if (iter.hasNext()) recno = " " +String.valueOf(iter.next());
System.out.println(" this recnum:" + recno);
while (iter.hasNext()){
recno += ""+String.valueOf(iter.next()));
System.out.println(" done recnum:" + String.valueOf(iter.next()));
}
the input is such: 061456 changes to 25390 061506 changes to 25414 061559 -> FINE
it took a while to figure out what it was doing, and apparently this is a common issue for java,
ideas? thanks
© Stack Overflow or respective owner