Start New Discussion within our Software Development Community

I've never coded in vbscript before in my life, but I need to trim some text with it.

So it's basically like this... script sits on a page and if it sees a certain definable text string, it removes it. I.E. IF: "blahblah" = true, then DELETE THE FRIGGIN' CRAP OUT OF IT! :mad:yarrr! :lol:

In my mind, it's gotta be dang easy, but I don't even know the syntax of vbscript yet... and at this point, I don't have any time to learn it. Any help on this?

I'm not sure the specifics of your page.... such as if this info is coming from a textbox or something. Also, being that it is a web page (if that is the case) then I promise you, it's a better solution to use Javascript. The reason that it is a better solution, is because you'll find it to be more universally compatible with W3C compliant browsers (which means your page will work in more browsers than just IE...). The solution to your problem, however, is an easy one. It's actually 1 line of code, so, if you can inline that with an onclick or whatever.... or you can use an entire sub, and place it in the head and call it when you want... but the VBScript solution to your problem is to use the command "replace". This is how you do it yourvariable = replace(yourvariable, "blahblahblah", "") . Yeah, it's just that easy. Naturally, you'll want to replace "yourvariable" with the variable that will contain the string to remove, and you'll want to replace "blahblahblah" with whatever it is you want to get rid of......

Below for better readability

yourvariable = replace(yourvariable, "blahblahblah", "")
This article has been dead for over six months. Start a new discussion instead.