VbScript to strip space of string? -
say have string = grilled cheese
how echo string without space between grilled cheese out changing string?
also if had string variables have space, full name. can show first letter of string:
wscript.echo left(strusername, 1) echo example g
but how show name after space (= cheese). keep in mind name after space may change "cheesy" example
wscript.echo mid(strusername,null)
not work
thanks!
the replace
function can used remove characters string. if echo return value without assigning variable, original string remain unchanged:
>>> str = "grilled cheese" >>> wscript.echo replace(str, " ", "") grilledcheese >>> wscript.echo str grilled cheese
another option split
, join
functions:
>>> str = "grilled cheese" >>> wscript.echo join(split(str, " "), "") grilledcheese >>> wscript.echo str grilled cheese
split
allow echo particular tokens original string:
>>> str = "grilled cheese" >>> wscript.echo split(str, " ")(1) cheese
Comments
Post a Comment