Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to escape slash (/) in VBScript?

How do you escape the forward slash character (/) in VBScript? For example, in the following string:

bob = "VU administration/front desk"
like image 989
phill Avatar asked Dec 08 '08 22:12

phill


People also ask

How do you escape a special character in VBScript?

Normally in most of the languages, the escape character is backslash ( \ ). In VBScript, the escape character is a double quote ( ” ) itself.

How do you remove a string slash?

Use the String. replace() method to remove a trailing slash from a string, e.g. str. replace(/\/+$/, '') . The replace method will remove the trailing slash from the string by replacing it with an empty string.

How do you add a special character in VBScript?

character, use \?. Marks the next character as either a special character, a literal, a backreference, or an octal escape. For example, 'n' matches the character 'n'. '\n' matches a newline character.


1 Answers

You don't escape it: it doesn't mean anything special in php or vbscript, and therefore doesn't need to be escaped. The only character you need to escape in vbscript is the double quote, which escapes itself:

MyString = "He said, ""Here's how you escape a double quote in vbscript. Slash characters -- both forward (/) and back (\) -- don't mean anything, even when used with common control characters like \n or \t."""

Similarly, in php a backslash escapes itself, but a forward slash doesn't need any special handling.

like image 84
Joel Coehoorn Avatar answered Sep 27 '22 19:09

Joel Coehoorn