?
Solved

Removing "00" from a number.

Posted on 2012-09-20
6
Medium Priority
?
360 Views
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".
0
Comment
Question by:RevJoker
  • 2
  • 2
5 Comments
 
LVL 13

Assisted Solution

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

number = (String) (int) number;


try that?
0
 
LVL 1

Accepted Solution

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

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

Author Comment

by:RevJoker
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.
0
 
LVL 45

Assisted Solution

by:AndyAinscow
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
0
 
LVL 45

Expert Comment

by:AndyAinscow
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.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

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…
Integration Management Part 2
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses
Course of the Month13 days, 15 hours left to enroll

807 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