Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

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