String Comparison

  • Thread starter Thread starter Qu
  • Start date Start date
Q

Qu

Hi everyone.

I'm trying to make an application in which people can type in their
own selection filter for an external application. For this, I need to
be able to compare a string to a value in much the same way a search
box does: "*" for a wildcard, AND and OR as their respective
comparisons, greater than> and less than<, etc...

Here's an example. The user could type this into the textbox:
">100 And <180 Or 240"
Which would be compared with a number and return true if the number
was between 100 and 180, or was 240.

Another example:
"*BRACE* Or SINGLE_BEAM"
Which would be compared with a string and return true if the string
contained the substring BRACE or exactly matched SINGLE_BEAM.

Is there an easy way to do this, or am I going to have to go through
the string character by character to extract the information? [crosses
fingers]

Thanks,
Qu.
 
Qu,

In my idea is mostly using the split the first way I try, probably is your
problem however a real Regex problem.

http://msdn2.microsoft.com/en-us/library/system.text.regularexpressio...

Cor

Thanks for the reference, I haven't used regular expressions or the
regex class before. I'll have to study them a bit, but they seem to be
fairly close to what I'm looking for. I just need to work out how
they're used and what they're capable of...
 
Hi everyone.

I'm trying to make an application in which people can type in their
own selection filter for an external application. For this, I need to
be able to compare a string to a value in much the same way a search
box does: "*" for a wildcard, AND and OR as their respective
comparisons, greater than> and less than<, etc...

Here's an example. The user could type this into the textbox:
">100 And <180 Or 240"
Which would be compared with a number and return true if the number
was between 100 and 180, or was 240.

Another example:
"*BRACE* Or SINGLE_BEAM"
Which would be compared with a string and return true if the string
contained the substring BRACE or exactly matched SINGLE_BEAM.

Is there an easy way to do this, or am I going to have to go through
the string character by character to extract the information? [crosses
fingers]

Thanks,
Qu.

Hi,

No, there is no easy way of doing that. You need to parse the string
(not an easy task per se) and generate a Regex struct to later use to
compare
 
Hi everyone.
I'm trying to make an application in which people can type in their
own selection filter for an external application. For this, I need to
be able to compare a string to a value in much the same way a search
box does: "*" for a wildcard, AND and OR as their respective
comparisons, greater than> and less than<, etc...
Here's an example. The user could type this into the textbox:
">100 And <180 Or 240"
Which would be compared with a number and return true if the number
was between 100 and 180, or was 240.
Another example:
"*BRACE* Or SINGLE_BEAM"
Which would be compared with a string and return true if the string
contained the substring BRACE or exactly matched SINGLE_BEAM.
Is there an easy way to do this, or am I going to have to go through
the string character by character to extract the information? [crosses
fingers]
Thanks,
Qu.

Hi,

No, there is no easy way of doing that. You need to parse the string
(not an easy task per se) and generate a Regex struct to later use to
compare- Hide quoted text -

- Show quoted text -

Looking into the help files on regular expressions I began to suspect
as much. Oh well... at least its a function I can write once and use
over and over. :) Thanks for your help.
 
Back
Top