473,387 Members | 1,548 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,387 software developers and data experts.

String Matching Problem (NUXI problem) ?

I have a binary file (actually it's in memory)
which saved character as a reverse-byte order which means

ABCDEFGX stores as BADCFEXG

is there some function like strstr() in c standard library to match
substring "BCDE" (but in reverse-order for) how could I do it?

while I try to solve my problem myself,I found
ABCDEFGX may stores AYCBEDGFRX in the binary file, Y,R are some
characters I don't care.

this maybe called NUXI problem or something like that I try to google
it out but can't find anything useful.

May 18 '06 #1
6 1679

timmu wrote:
I have a binary file (actually it's in memory)
which saved character as a reverse-byte order which means

ABCDEFGX stores as BADCFEXG

is there some function like strstr() in c standard library to match
substring "BCDE" (but in reverse-order for) how could I do it?


I'm not certain I understand your problem...if you
are trying to match "this string.", why don't
you just search for "htsis rtni.g"?

May 18 '06 #2
well, my problem is
"this string" may be presented like
"htsis rtni.g" or "tXih srtnig" where X character is something I don't
need.

actually I need to parse some strings like "arg1=On,arg2=False"
which "arg2" may present like "ra2gF=" or "a,gr=2"

May 18 '06 #3
On 2006-05-18, Bill Pursell <bi**********@gmail.com> wrote:

timmu wrote:
I have a binary file (actually it's in memory)
which saved character as a reverse-byte order which means

ABCDEFGX stores as BADCFEXG

is there some function like strstr() in c standard library to match
substring "BCDE" (but in reverse-order for) how could I do it?


I'm not certain I understand your problem...if you
are trying to match "this string.", why don't
you just search for "htsis rtni.g"?


Because he could be looking for "t?ih stsirgn?." instead?
May 18 '06 #4
On Thu, 18 May 2006 09:38:00 -0700, timmu wrote:
I have a binary file (actually it's in memory)
which saved character as a reverse-byte order which means

ABCDEFGX stores as BADCFEXG

is there some function like strstr() in c standard library to match
substring "BCDE" (but in reverse-order for) how could I do it?

while I try to solve my problem myself,I found
ABCDEFGX may stores AYCBEDGFRX in the binary file, Y,R are some
characters I don't care.

this maybe called NUXI problem or something like that I try to google
it out but can't find anything useful.


The usual rule round here is to post actual (minimal) code the exhibits the
problem.

For example, cut down the program that "may store" ABCDEFGX as AYCBEDGRX,
post it here and you will be flooded with helpful replies.

--
Ben.
May 18 '06 #5

timmu wrote:
I have a binary file (actually it's in memory)
which saved character as a reverse-byte order which means

ABCDEFGX stores as BADCFEXG
Actually it stored binary WORD values in little endian byte order. (at
least I think that's it. I sometimes confuse little endian and big
endian.)
is there some function like strstr() in c standard library to match
substring "BCDE" (but in reverse-order for) how could I do it?
Why not just write a simple filter program or routine to reverse the
bytes?

while I try to solve my problem myself,I found
ABCDEFGX may stores AYCBEDGFRX in the binary file, Y,R are some
characters I don't care.

this maybe called NUXI problem or something like that I try to google
it out but can't find anything useful.


try looking for little endian and big endian

ed

May 19 '06 #6

"timmu" <ti****@gmail.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
I have a binary file (actually it's in memory)
which saved character as a reverse-byte order which means

ABCDEFGX stores as BADCFEXG

is there some function like strstr() in c standard library to match
substring "BCDE" (but in reverse-order for) how could I do it?

while I try to solve my problem myself,I found
ABCDEFGX may stores AYCBEDGFRX in the binary file, Y,R are some
characters I don't care.

this maybe called NUXI problem or something like that I try to google
it out but can't find anything useful.

The best solution is to write a function

unscramble(char *littleendian)
{
}
This is trivial to implement. The only snag is that you need to know the
phase - whether you start in the middle of 16-bit block or not.
--
www.personal.leeds.ac.uk/~bgy1mm

May 20 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Martin Robins | last post by:
I am trying to parse a string that is similar in form to an OLEDB connection string using regular expressions; in principle it is working, but certain character combinations in the string being...
3
by: Old Wolf | last post by:
Hi all. G++ fails to compile the following: #include <string> int main() { std::string foo("abc=123"); std::string::const_iterator delimiter = std::find(foo.begin(), foo.end(), '=');
19
by: Paul | last post by:
hi, there, for example, char *mystr="##this is##a examp#le"; I want to replace all the "##" in mystr with "****". How can I do this? I checked all the string functions in C, but did not...
5
by: olaufr | last post by:
Hi, I'd need to perform simple pattern matching within a string using a list of possible patterns. For example, I want to know if the substring starting at position n matches any of the string I...
5
by: Martin Jørgensen | last post by:
Hello again, Sorry to bother but I guess my C++ book isn't very good since it obviously contains errors so the program code doesn't work with g++. However I don't understand what the problem...
2
by: laura | last post by:
Hi, I'm looking for the algorithm which does the lowest number of comparison for the string matching problem (in the worst case). I know that the complexity is liniar in the length of the...
3
by: Morten71 | last post by:
I have a strange problem. I have a local string() var I populate this way: clmns() As String = {"InvoiceNo", "InvoiceDate"} When I call: Array.IndexOf(clmns,"InvoiceDate") I get 0 (zero) as...
9
by: | last post by:
I am interested in scanning web pages for content of interest, and then auto-classifying that content. I have tables of metadata that I can use for the classification, e.g. : "John P. Jones" "Jane...
11
by: tech | last post by:
Hi, I need a function to specify a match pattern including using wildcard characters as below to find chars in a std::string. The match pattern can contain the wildcard characters "*" and "?",...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
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...

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.