473,396 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

string comparison and wildcards

553 512MB
Hi

I have a string comparison code from VB.
While (Not ((myString Like "??????") And (myString Like "00*")))

All i am wondering is if we can do the similar thing in C/C++ i.e
using 'Like' keyword and doing wildcards like in above example?
Aug 14 '07 #1
3 5030
sicarie
4,677 Expert Mod 4TB
Hi

I have a string comparison code from VB.
While (Not ((myString Like "??????") And (myString Like "00*")))

All i am wondering is if we can do the similar thing in C/C++ i.e
using 'Like' keyword and doing wildcards like in above example?
There are a few different ways to do it in C/C++ - using a regular expression, or using string methods. It depends on what you want to match and how many times you want to match it. I would recommend looking into the string methods or Boost's Regex library (I'm sure there are others, that's just the first that comes to mind). And if you post more about what you are trying to do (how specific a match you need, how many times you need that specific a match, etc...), we can probably point you to one of those specifically - or maybe even something else entirely (if someone else sees another method I didn't put).
Aug 14 '07 #2
questionit
553 512MB
Hi

I have used those string functions in past. I dont understand if any of these can be used to do a wildcard search.

I have no specific comparison but i was wondering if something is available in C/C++ same as 'Like' Operator in VB and SQL. ?

i know if i have a specific coomparison, i would be able to put many functions together to get the result but this would be alot of work whereas 'Like' does all


There are a few different ways to do it in C/C++ - using a regular expression, or using string methods. It depends on what you want to match and how many times you want to match it. I would recommend looking into the string methods or Boost's Regex library (I'm sure there are others, that's just the first that comes to mind). And if you post more about what you are trying to do (how specific a match you need, how many times you need that specific a match, etc...), we can probably point you to one of those specifically - or maybe even something else entirely (if someone else sees another method I didn't put).
Aug 14 '07 #3
sicarie
4,677 Expert Mod 4TB
Hi

I have used those string functions in past. I dont understand if any of these can be used to do a wildcard search.

I have no specific comparison but i was wondering if something is available in C/C++ same as 'Like' Operator in VB and SQL. ?

i know if i have a specific coomparison, i would be able to put many functions together to get the result but this would be alot of work whereas 'Like' does all
A regex can do a wildcard search using either the * as the all or the . as the any single tokens. Looking at the links might help.
Aug 14 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

21
by: Chris S. | last post by:
I have a number of strings, containing wildcards (e.g. 'abc#e#' where # is anything), which I want to match with a test string (e.g 'abcdef'). What would be the best way for me to store my strings...
2
by: Jon | last post by:
Hi, I am trying to pick up records from a date range without much luck. For my example below I am trying to pick up all records made in the last month. However none are being found (my code is...
11
by: Shyguy | last post by:
I need to import a text file pretty much daily. I download the file and change the name to a standard name and then run the code to import the file into a table in my database. The problem is...
10
by: Alvaro Puente | last post by:
Hi all! Do any of you know if wildcards are accepted when calling rename() function? Thanks/Alvaro
1
by: Anandan | last post by:
Hi, This is regarding Dataset Filter: WILDCARD CHARACTERS Both the * and % can be used interchangeably for wildcards in a LIKE comparison. If the string in a LIKE clause contains a * or %,...
26
by: Neville Lang | last post by:
Hi all, I am having a memory blank at the moment. I have been writing in C# for a number of years and now need to do something in VB.NET, so forgive me such a primitive question. In C#, I...
1
by: Nitinkcv | last post by:
Hi, I have a textbox and a button. In my textbox i have to enter the query string(say shoes) and on clicking the button takes me to a page show all item related to the search string( in this case...
1
by: numinix | last post by:
I need to sanitize a string that may contain unidentified character entities represented as \x99, \x98, etc. I need to do a simple str_replace to replace \x** with "". Is there a way to use...
1
by: questionit | last post by:
Hi I have a string comparison code from VB. While (Not ((myString Like "??????") And (myString Like "00*"))) All i am wondering is if we can do the similar thing in Java i.e using...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
0
Oralloy
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,...
0
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...
0
tracyyun
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...
0
agi2029
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.