From: Dennis Rose Dennis on
I need to use the following string as a "Search String" in an Instr
instruction:

<name part="first">

The quotes around the word "first" are causing the instruction to fail.

How can I test for this Search String?

I have checked Google and tried single quotes and double quotes and chr(34)
around around the word "first" all with no success.

The code I am using is"
SearchString = "<name part="first">"
StringPos = Instr(1, InputDataLine, StringSearch)
If StringPos > 0 then ......

Please help!!
From: Patrice on
Hello,

> <name part="first">
>
> The quotes around the word "first" are causing the instruction to fail.

You can include " in a literal string by using "" (double the double quote
character). Here it will be :

SearchString = "<name part=""first"">"

> I have checked Google and tried single quotes and double quotes and
> chr(34)
> around around the word "first" all with no success.

If you really tried

SearchString = "<name part=""first"">" then it could be be that you really
don't have this string in "InputDataLine".

For example could it be that you are searching actually for :
<name part="first"/>

Note the trailing /> rather than just >

What if you try with hardcoded values to make sure this is not just that
InputDataLine doesn't contain what you think ?

--
Patrice



From: Bob Butler on

"Dennis Rose" <Dennis Rose(a)discussions.microsoft.com> wrote in message
news:1EDE11CE-8D50-4A18-B59C-95C45B849EFC(a)microsoft.com...
>I need to use the following string as a "Search String" in an Instr
> instruction:
>
> <name part="first">
>
> The quotes around the word "first" are causing the instruction to fail.
>
> How can I test for this Search String?
>
> I have checked Google and tried single quotes and double quotes and
> chr(34)
> around around the word "first" all with no success.
>
> The code I am using is"
> SearchString = "<name part="first">"

SearchString = "<name part=""first"">" ' two quotes in a row gives one quote
in the result

> StringPos = Instr(1, InputDataLine, StringSearch)
> If StringPos > 0 then ......
>
> Please help!!

From: Helmut Meukel on
"Dennis Rose" <Dennis Rose(a)discussions.microsoft.com> schrieb im Newsbeitrag
news:1EDE11CE-8D50-4A18-B59C-95C45B849EFC(a)microsoft.com...
>I need to use the following string as a "Search String" in an Instr
> instruction:
>
> <name part="first">
>
> The quotes around the word "first" are causing the instruction to fail.
>
> How can I test for this Search String?
>
> I have checked Google and tried single quotes and double quotes and chr(34)
> around around the word "first" all with no success.
>
> The code I am using is"
> SearchString = "<name part="first">"
> StringPos = Instr(1, InputDataLine, StringSearch)
> If StringPos > 0 then ......
>

As Patric and Bob already showed you, double double quotes will do.
This will work too:
SearchString = "<name part=" & chr(34) & "first" & chr(34) & ">"

Helmut.



From: Dennis Rose on
Thanks for the reply.
I can see <name part="first"> in the data string that I am searching so I
know it is there. I tried it again and it does not work with double quotes
around the word "first".


"Patrice" wrote:

> Hello,
>
> > <name part="first">
> >
> > The quotes around the word "first" are causing the instruction to fail.
>
> You can include " in a literal string by using "" (double the double quote
> character). Here it will be :
>
> SearchString = "<name part=""first"">"
>
> > I have checked Google and tried single quotes and double quotes and
> > chr(34)
> > around around the word "first" all with no success.
>
> If you really tried
>
> SearchString = "<name part=""first"">" then it could be be that you really
> don't have this string in "InputDataLine".
>
> For example could it be that you are searching actually for :
> <name part="first"/>
>
> Note the trailing /> rather than just >
>
> What if you try with hardcoded values to make sure this is not just that
> InputDataLine doesn't contain what you think ?
>
> --
> Patrice
>
>
>
> .
>
 |  Next  |  Last
Pages: 1 2 3 4 5 6 7
Prev: Combinations
Next: 7-bit and News Servers