Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text String format

Status
Not open for further replies.

pdbowling

Programmer
Mar 28, 2003
267
US
Hi all,
I've got a Public variable.
It gets set to "NONE". I compare this string in a function and it has subtly changed to "N0NE" with a narrow
0 instead of O
0,O
It's not much but if I want to compare
"N0NE" with "NONE" they aren't going to match (already done)
How can I either
A) Prevent the conversion (automatic somewhere)
B) Re-convert it back with a function (I can't just look for "N" because there are N135 or N201 entries etc.)
What's going on?
Thanks everyone.
PB
 
The real answere is to find out why NONE changes to N0NE, but in the mean time could you test for both...
IF ??? = "NONE" OR ??? = "N0NE" THEN ....
 
why not test to see if the 3rd and 4th letters are 'NE'?

IF MID(myString,2,2)="NE" THEN
'do stuff
ELSE
'do other stuff
END IF

BB
 
Sorry, the line should have been:

IF MID(myString,3,2)="NE" THEN
'do stuff

One line and I made a mistake. Oooops

BB
 
Do an Edit|Find on N0NE (that's NzeroNE) searching whole project. That way you should find the typo

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
I have already searched the entire project and
NzeroNE is not in it. I've traced every line of code in around before and after all functions using the variable. At no point anywhere does it get assigned to NzeroNE in my code. I'm using it in one function and it's fine, then in the next function on the next line "poof", it's changed.
It looks like a WYSYWYG Microsoft conversion or something.
Any other ideas?
PB
 
You could also search the project for substring manipulation of the field, e.g. mid(fldName,1,2), to see whether Noh is being changed to Nzero.

You're certain it's not just a font translation, (in which case there's no problem)?

Can you post the code for our perusal, please?!

 
Ok. Let's nail this.

First of all, we need to confirm that we are dealing with a zero. To do this, copy the expression into a string called strtemp, and then find out what this gives you...

Code:
asc(mid(strtemp,2,1))

If that returns 48, then you are indeed dealing with a zero. If it returns 79 (capital O) then I for one am confused...

You can also set a watch to break when the contents of a variable change, which gives you a way to try and identify where the zero is being set, if that is indeed your problem.


 
>>You can also set a watch to break when the contents of a variable change, which gives you a way to try and identify where the zero is being set, if that is indeed your problem.


That's the solution, you can rest assure that the narrow one (or maybe that wide one, but most likely the narrow one) is indeed a ZERO.

Greetings,
Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top