Solved

# Removing "00" from a number.

Posted on 2012-09-20
354 Views
Okay lets say the number is "00394780" i need to remove the "00" from the number which will make it into "394780".
0
Question by:RevJoker

LVL 13

Assisted Solution

String number = "00394780";

number = (String) (int) number;

try that?
0

LVL 1

Accepted Solution

Found a solution.

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

LVL 1

Author Comment

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.
0

LVL 43

Assisted Solution

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
0

LVL 43

Expert Comment

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.
0

## Featured Post

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…
Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…