Removing "00" from a number.

Posted on 2012-09-20
Medium Priority
Last Modified: 2012-09-21
Okay lets say the number is "00394780" i need to remove the "00" from the number which will make it into "394780".
Question by:RevJoker
  • 2
  • 2
LVL 13

Assisted Solution

themrrobert earned 1000 total points
ID: 38420196
String number = "00394780";

number = (String) (int) number;

try that?

Accepted Solution

RevJoker earned 0 total points
ID: 38420630
Found a solution.

string a = "000012340";
string b = a.TrimStart('0');

Author Comment

ID: 38420995
I've requested that this question be closed as follows:

Accepted answer: 0 points for RevJoker's comment #a38420630

for the following reason:

Found it and works fine.
LVL 45

Assisted Solution

AndyAinscow earned 1000 total points
ID: 38420734
Just an aside.

>>Okay lets say the number is "00394780"

Actually that is a string not a number.  ANY numeric variable (int, long....) will not have leading zero's, they will only appear if you
a) convert it to a string
b) instruct the formatting of the string to have leading zero's
LVL 45

Expert Comment

ID: 38421013
I've asked for a moderator to accept your answer (trim - which is the simplest way to do what you wanted) as you originally requested - as I said my comment was purely for your information.

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
To export Lotus Notes to Outlook PST or Exchange and Domino Server files to Exchange Server or PST files with ease, go for Kernel for Lotus Notes to Outlook conversion tool. Through the video, you can watch the conversion process. A common user with…
Did you know PowerShell can save you time with SaaS platforms? Simply leverage RESTfulAPIs to build your own PowerShell modules. These will kill repetitive tickets and tabs, using the command Invoke-RestMethod. Tune into this webinar to learn how…

569 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question