vendredi 27 février 2015

vbScript; how to replace spaces after certain character in string

I'm just wondering if there is a way to replace all blank spaces after a certain character in a string. Basically a string like;



str = "This is a test - 1, 2, 3, 4, 5"


I would like essentially remove all of the spaces after the '-'. I understand how to do the



replace(str," ","")


but that will remove every space, and I want to keep the 'This is a test -" intact for readability to the user. I have used



Instr(str,"-")


to get the position of that character but do not know how to then enact the replace function on the rest of the string starting from that point.


Aucun commentaire:

Enregistrer un commentaire