
Anonymous
Not applicable
2017-05-05
07:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Losing leading “0” Zeros when converting to integer from string
Hello,
When I am converting a String to an Integer, I am losing the leading zeros from my variable.
I tried this 'Integer.parseInt((row1.date.length()==5)?"0"+row1.date:row1.date ) ' but it didin't work
Exemple :
Input data : '012005'
In Output data I have : '12005'
Someone can help me please?
Thank you
909 Views
1 Solution
Accepted Solutions

Specialist
2017-05-05
11:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There's no notion of leading zeroes when storing numbers in a numeric format. If you need to preserve zeroes throughout the job, it has to be a String. If this is only an issue when you output the data at the end, you can convert back to a String, padding the value with leading zeroes as needed.
909 Views
2 Replies

Partner - Creator III
2017-05-05
09:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Maria,
As per my understanding, if you convert any value to number it will remove '0' zero in the begin. Because there is no value for '0' zero if it is before some number, if zero '0' present after number then it has some value.
Regards,
Veeru
As per my understanding, if you convert any value to number it will remove '0' zero in the begin. Because there is no value for '0' zero if it is before some number, if zero '0' present after number then it has some value.
Regards,
Veeru
909 Views

Specialist
2017-05-05
11:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There's no notion of leading zeroes when storing numbers in a numeric format. If you need to preserve zeroes throughout the job, it has to be a String. If this is only an issue when you output the data at the end, you can convert back to a String, padding the value with leading zeroes as needed.
910 Views
