Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Searching string for double quotes

Tags:

vba

When searching for a double quote using Instr, I know that you need to use 4 double quotes for the search string Instr(String,""""), or alternatively, Instr(String, Chr(34)). What I don't quite understand is why 3 double quotes don't work Instr(String,""")

I have Googled for this, but haven't come across the answer I'm looking for. I realize this is a very basic question, but I can't seem to get my head around it.

like image 929
DaveU Avatar asked Nov 27 '13 23:11

DaveU


People also ask

How do you find a double quote in a string?

To check if the string has double quotes you can use: text_line. Contains("\""); Here \" will escape the double-quote.

How do you grep a string with a quote?

Whenever you use a grep regular expression at the command prompt, surround it with quotes, or escape metacharacters (such as & ! . * $ ? and \ ) with a backslash ( \ ). finds any line in the file list starting with "b." displays any line in list where "b" is the only character on the line.

How do you match double quotes in regex?

Firstly, double quote character is nothing special in regex - it's just another character, so it doesn't need escaping from the perspective of regex. However, because Java uses double quotes to delimit String constants, if you want to create a string in Java with a double quote in it, you must escape them.


1 Answers

The "" is just quoting a " - therefore, """ means "_here comes a double quote - and VBA lacks the closing "!

In other words:

  • x = "" -> Content of is blank
  • x = """" -> Content of x is "
  • x = """ -> VBA cannot compile, as it reads here comes a string (the first ") that contains a double quote ("") - but then does not find the closing "...
like image 196
Peter Albert Avatar answered Sep 24 '22 05:09

Peter Albert