B
Brett Grant
I am using word 2000.
I have a document that describes a software product. In the document,
for each function, there are a number of tables that deliniate the
local variables, public variables, persistants, etc. The last section
under each function contains some pseudocode. I wrote a parser for
the pseudocode that returns an array of strings that contain all of
the variables in the pseudocode. The variables in the tables are
available to me as an array of ranges. The problem is that these
variables may contain greek symbols inseted from the Insert|Symbol
dialog box, such as gamma, delta, omega, etc.
Well, I did a search and found all of the problems associated with
inserted symbols. I was playing around in the immediate window and
found that if I do this:
print strcomp(String_array(1),range_array(1).text,vbTextCompare)
returns +/-1
This seems odd to me since if I print each of strcomp inputs I get
something like this:
print String_array(1)
double_?e
print range_array(1).text
double_?e
These are exactly the same, so strcomp should return a 0, but it
doesn't.
On the off chance that the characters may be different I checked:
print asc(mid(String_array(1),8,1))
63
print asc(range_array(1).characters(8).text)
63
which tells me that they should be the same. I then tried to strcomp
just the two characters and it returns +/- 1 and I didn't expect that.
So in desparation, I selected the pseudocode variable and tried this:
print strcomp(range_array(1).text,selection.range.text,vbcomparetext)
and it returns a 0!
I don't understand why this works, whereas all of the previous tries
do not. The obvious solution is to rewrite my pseudocode parser to
return the ranges, but I am just trying to understand why one method
works, while the other does not. Are there some undocumented
properties of strcomp that allow it to figure out the mystery
character? Anybody else have any experience with this? I could find
anything with a google search.
Thanks,
Brett
I have a document that describes a software product. In the document,
for each function, there are a number of tables that deliniate the
local variables, public variables, persistants, etc. The last section
under each function contains some pseudocode. I wrote a parser for
the pseudocode that returns an array of strings that contain all of
the variables in the pseudocode. The variables in the tables are
available to me as an array of ranges. The problem is that these
variables may contain greek symbols inseted from the Insert|Symbol
dialog box, such as gamma, delta, omega, etc.
Well, I did a search and found all of the problems associated with
inserted symbols. I was playing around in the immediate window and
found that if I do this:
print strcomp(String_array(1),range_array(1).text,vbTextCompare)
returns +/-1
This seems odd to me since if I print each of strcomp inputs I get
something like this:
print String_array(1)
double_?e
print range_array(1).text
double_?e
These are exactly the same, so strcomp should return a 0, but it
doesn't.
On the off chance that the characters may be different I checked:
print asc(mid(String_array(1),8,1))
63
print asc(range_array(1).characters(8).text)
63
which tells me that they should be the same. I then tried to strcomp
just the two characters and it returns +/- 1 and I didn't expect that.
So in desparation, I selected the pseudocode variable and tried this:
print strcomp(range_array(1).text,selection.range.text,vbcomparetext)
and it returns a 0!
I don't understand why this works, whereas all of the previous tries
do not. The obvious solution is to rewrite my pseudocode parser to
return the ranges, but I am just trying to understand why one method
works, while the other does not. Are there some undocumented
properties of strcomp that allow it to figure out the mystery
character? Anybody else have any experience with this? I could find
anything with a google search.
Thanks,
Brett