Removing "00" from a number.

Posted on 2012-09-20
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
    LVL 13

    Assisted Solution

    String number = "00394780";

    number = (String) (int) number;

    try that?
    LVL 1

    Accepted Solution

    Found a solution.

    string a = "000012340";
    string b = a.TrimStart('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.
    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
    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.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    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++ ( 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 (, 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…

    728 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

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now