Hi James,
Your
'"'
is a character constant, hence an integer:
print ('"');
gives you 34, see
http://www.doornik.com/ox/oxsyntax.html#ox_syntax_RefChConst
You are looking for a string constant, which is
print ("\"");
(using the \ to escape the special meaning of the quote). This you could
use in your comparison as well,
if(thing[i:i]=="\"")
does not give an error.
Otherwise, use the character constant in the comparison, also
if(thing[i]=='"')
should work well, as thing[i] gives you the (integer) character
constant, which you can compare to 34.
Greetings,
Charles
On 07/27/2012 01:27 PM, James Reade wrote:
> Dear all,
>
> Very basic question this one; how does one search for a quotation mark (") in Ox? I thought using the single marks (') would work, but if(thing[i:i]=='"') returns "Runtime error: 'string[1] != int' bad operand". I'm sure I'm missing something very simple here.
>
> Thanks in advance,
>
> James.
>
> J. James Reade
> Lecturer, Department of Economics
> University of Birmingham
> Birmingham B15 2TT
>
> [log in to unmask]
> www.jamesreade.co.uk
> Tel: +44 (0) 121 415 8359
> Mob: +44 (0) 781 697 7830
> Fax: +44 (0) 121 414 7377
|