Concantinate Leading zeros when extracting data from a SQL query and exporting that data to a ".txt" file
A sample of my code is below, but when some of the numbers are exported, they will have a "0" in front because I am pulling 5 numbers. I need to get rid of leading 0 if that number is say 4951 it will automatically place a 0 in front making it 04951.
//Concatinate Client and Matter numbers to 4 digits
if ( Matter_Number.length() > 5 )
Client_Number = Client_Number.substring( Client_Number.length()-5, Client_Number.length() );
Matter_Number = Matter_Number.substring( Matter_Number.length()-5, Matter_Number.length() );
System.out.println( "Error! Matter too short" + Matter_Number );
print_writer1.println( Client_Number + "|" + Client_Name.trim() + "|" + Matter_Number + "|"+ Matter_Name.trim() + "|" + Practice_Number );
Re: Concantinate Leading zeros when extracting data from a SQL query and exporting that data to a ".txt" file
If the number was an int it wouldn't be possible to have leading zeroes.