Is there a C# "Like" statement for comparing two strings?
if(stringA Like "%diabe%mel %)
do stuff...
Thanks in advance!
Derrick 4 7272
"Derrick" <de*********@ex cite.com> wrote in news:umhmc1aHEH A.3032
@TK2MSFTNGP09.p hx.gbl: Is there a C# "Like" statement for comparing two strings?
if(stringA Like "%diabe%mel %) do stuff...
the Regex class (in System.Text.Reg ularExpressions ) can do this for you.
For example:
Regex rgx = new Regex("diabe.*m el");
if (rgx.IsMatch(st ringA))
{
// Its a match
}
-mdb
Thanks, is it possible to have a regex to searches with "in any order" for
the params passed, in one call without creating all the possible word orders
as seperate regex'es?
With the below example, if a user types "diabe mel", find words that match,
basically, "%diab%mel% " as well as "%mel%diab% "
Thanks again for the help!
Derrick
"Michael Bray" <mb************ *******@SkPiAlM l.ctiusa.com> wrote in message
news:Xn******** *************** ***********@207 .46.248.16... "Derrick" <de*********@ex cite.com> wrote in news:umhmc1aHEH A.3032 @TK2MSFTNGP09.p hx.gbl:
Is there a C# "Like" statement for comparing two strings?
if(stringA Like "%diabe%mel %) do stuff...
the Regex class (in System.Text.Reg ularExpressions ) can do this for you. For example:
Regex rgx = new Regex("diabe.*m el"); if (rgx.IsMatch(st ringA)) { // Its a match }
-mdb
"Derrick" <de*********@ex cite.com> wrote in
news:#6******** ******@TK2MSFTN GP12.phx.gbl: Thanks, is it possible to have a regex to searches with "in any order" for the params passed, in one call without creating all the possible word orders as seperate regex'es?
With the below example, if a user types "diabe mel", find words that match, basically, "%diab%mel% " as well as "%mel%diab% "
Sure... use the '|' operator, meaning this|that. So you could use the
regex "diab.*mel|mel. *diab"
-mdb
Hi Derrick
you can use String.Equals Method which determines whether two String
objects have the same value
string k;
string m;
if (m.equals(k))
you can read more on this link http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemstri ngclassequalsto pic.asp
Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Adam Short |
last post by:
I've never needed it before but now I do!
Does anyone know if you are able to perform a NOT Like search using Classic
ASP ADO?
i.e. myData.Filter = "Ref NOT LIKE '*1234*'"
by the way this doesn't work!! and neither does myData.Filter = "Ref <> LIKE
'*1234*'"
|
by: Peter |
last post by:
My problem is the last bit of coding below, the like statement does not
work. what I have is a product options field and in it is stored characters
i.e. "avcy" etc what the query does is that if I type in any single
character all the products that match the criteria should be displayed. So
if I typed in an "a" I should get 3 returns (see below) Fields could look
like this:
product.options:
bhw
djhsa
|
by: TD |
last post by:
I created a query in Access 2000 that runs perfectly. I then copied the
"sql" version of the same query and set it equal the variable "sql" in the
code below. When I run the code below I get an "Type Mismatch" error. Can
someone explain how to fix this?
Thanks,
TD
Private Sub cmdSave_Click()
|
by: Big John |
last post by:
in Access 2003 I am trying to get sql query to run using a field as
input, but I want to input into the field a value that uses the "like"
operator to find any value that starts with the value placed in the
field.
e.g if i place the text "ada" in the field i want all values with
"ada???????" when the sql is run. I can do it in a query by placing the
value in a like statement and it gives all variations , but i want the
value to be a...
|
by: Derrick |
last post by:
Is there a C# "Like" statement for comparing two strings?
if(stringA Like "%diabe%mel%)
do stuff...
Thanks in advance!
Derrick
| |
by: Craig Kenisston |
last post by:
Hi,
I need to write a function that should behave like the SQL's "like" operator
on a list of words.
I was wondering if I can use Regex directly to do this job. But I've been
reading about regex and it supports very different characters and behaves
different.
So, I'm looking for an advise. I'd like to know if it is feasable or not, I
mean, if dotnet Regex implementation could handle it.
|
by: Drum2001 |
last post by:
Hello All!
I am using the following code during an On Click event for a button.
It works properly to create a query for a report:
Private Sub Command14_Click()
If IsNull(Me.Text30) Then
' No criteria here - so ignore
Else
strWhere = strWhere & ",'" & Me.Text30.Value & "'"
|
by: unamas |
last post by:
hi,
Good day!
Anyone generous enough to help me with this query. Anyway,
I have a random acount number of 1, 2, 3, 4, 5 and i wanna get the results after this number in a table.
Select * from table where account like ('1%','2%', '3%','4%','5%')
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |