I have a textbox and i want to take off the last character of that word for using in another purpose.
Is this possible?
Take off last character of a word
5 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Alex38 reputationPosted Aug 11, 2008, 8:02 PM EDT
string s = textBox1.Text.Substring(textBox1.Text.Length - 1, 1);
char c = textBox1.Text.ToCharArray()[textBox1.Text.Length - 1];
Arnold Petrona156 reputationPosted Aug 11, 2008, 8:25 PM EDT
Ryan AlfordRank #1,411 · 1.2K reputationPosted Aug 12, 2008, 5:19 AM EDT
Arnold Petrona156 reputationPosted Aug 13, 2008, 6:59 AM EDT
Good Morning
I test it but it give me a wrong answer
I have the following
the string is as follow ; "1.3.6.1.2.1.2.1.0" . Now i have to take of the last one ( the 0) with the code that you give me is as follow in mine program
string m = texbox8.text.Text.Substring(this.textbox8.text.length-1,1);
during mine running process it give me the m as 0.
but i need to have m as "1.3.6.1.2.1.2.1."
AlanRank #669 · 3.6K reputationPosted Aug 13, 2008, 7:23 AM EDT
For that you need:
string m = textBox8.Text.Substring(0, textBox8.Text.Length - 1);