Alamin Aji Alamin Aji - 1 year ago 106
Java Question

Remove leading zeros from a number in a string

I wanna trim this string.


How i can get just the "819780" part.

I can do it with my way, just curious is there any "elegant" or "right" way to do this.

Answer Source

I hope this works:

   try {
   int i=Integer.parseInt(yourString)
   }catch(Exception e)
   {//String has something more than number