Remove first character in a do while statement

Posted on 2008-10-28
Last Modified: 2013-12-17
I have a Do while statement that I can't get to work. What I would like to do is trim the front of a text box.  For example if a user enters "0001" I would like to trim it to "1".  I think I'm using the Remove function wrong because it just goes on continuous loop right now.  Thanks
string Search = Convert.ToString(SearchTextBox.Text);
            while (Search.StartsWith("0"));

Open in new window

Question by:deloused
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 37

Accepted Solution

gregoryyoung earned 250 total points
ID: 22826862
string search="000000120";
search = search.TrimStart('0');


LVL 20

Expert Comment

ID: 22826893
Try this:

string s = SearchTextBox.Text;
        string Search = Convert.ToString(s);
            s = s.Remove(0, 1);
        while (s.StartsWith("0"));

Open in new window


Author Closing Comment

ID: 31510968
Thanks, worked perfect!

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

726 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