String Comparision

  • Thread starter Thread starter Stephen
  • Start date Start date
S

Stephen

Hi,

Whats the best way to compare string?
I have a text box, the text of which should not contain "P.O. Box" or "Box"
or "PO Box"

Stephen.
 
Whats the best way to compare string?
I have a text box, the text of which should not contain "P.O. Box" or "Box"
or "PO Box"

You could use regular expresions.

Otherwise, if you're fairly confident those are the most likely/only
combinations, then you can just use instr:

if (instr(yourString, "P.O.") > 0) or (instr(yourString, "PO ") > 0) or
(instr(yourString, "Box") > 0) then...

-Darrel
 
Maybe create a checkbox they can select if they have a PO Box and if checked
allow them to put a number in there. Or you can do an txtBox.IndexOf("Box")
= 0 but you might have problems if they live on John Box Street.
 
Whats the best way to compare string?

Hemp is biodegradeable, but nylon is much stronger.

--
;-),
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
 
Hi Stephen,

Sorry about the little joke. I was feeling mischievous.

After re-reading your question, as well as the answers you've already
received, I'm thinking that it might help to suggest that, rather than
defining what should NOT be in the text box, what exactly SHOULD be in the
text box? That would be a better way to approach the question.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
 
Back
Top