Page 1 of 1

Help in remove text

Posted: Sun Dec 01, 2013 6:09 pm
by troop
hi

i have a small problem, i want to do something like this:

i have a textbox and i want to press a button and it removes for example all the "the's" in it, but i think it can be done by

textbox1.text = textbox1.text.replace("the,"") I THINK it looks like this if not tell me

also i want a second help (part 2)

I have a textbox2.text i want to remove ONLY the first the in it, like if it was
the car is the best
it will remove the first the and keep the all rest, so it be then "car is the best" hope u get me

plz help i know this is just 1 lines of code but i didnt find it anywhere

Re: Help in remove text

Posted: Sun Dec 01, 2013 6:25 pm
by comathi
Removing all instances of "the" in your TextBox is indeed as easy as:
Code: Select all
TextBox1.Text = TextBox1.Text.Replace("the", "")
Removing only the first instance isn't that much harder. You must use the TextBox.Text Substring:
Code: Select all
TextBox1.Text = TextBox1.Text.Substring(TextBox1.Text.IndexOf("the") + 3)
This will find the first occurence of "the" in your text, add 3 to the position and keep the rest of the text only. If you wish to remove "the" and the following space, do +4 instead of +3 cooll;

Re: Help in remove text

Posted: Sun Dec 01, 2013 6:29 pm
by troop
man who are u!!!!!!!


WHY ARE U THE BEST PEPRSON ALIVE I LOVE U ( HO MO) xD jk

i will try it now

Re: Help in remove text

Posted: Sun Dec 01, 2013 7:02 pm
by troop
works thanks!

Re: Help in remove text

Posted: Sun Dec 01, 2013 7:59 pm
by Filip
Hello troop,

Please try editing your posts instead of posting 2+ posts in a row.. Also use reputation system to say thanks to someone, not post it (We want to keep the community clean of short generic posts)

Re: Help in remove text

Posted: Sun Dec 01, 2013 8:00 pm
by troop
sorry cryer;