473,396 Members | 2,009 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.

Question on using "strcmp" to compare unicode strings

Hi all,
I am confused by the rule of comparing two unicode string using
function "strcmp".
For exmaple, using "strcmp" to compare two Chinese uincode string,
depending on what rule can "PHP" decide one string is greater or less
than the other string?

Thank you for suggestions!
Jul 17 '05 #1
2 8968
Lian <Li**@hehe.net> wrote:
I am confused by the rule of comparing two unicode string using
function "strcmp".
For exmaple, using "strcmp" to compare two Chinese uincode string,
depending on what rule can "PHP" decide one string is greater or less
than the other string?


My guess would be that it works the same as in ASCII, the position of
the character in the unicode characterset.

--

Daniel Tryba

Jul 17 '05 #2
On Wed, 15 Sep 2004 16:41:41 +0800, Lian <Li**@hehe.net> wrote:
I am confused by the rule of comparing two unicode string using
function "strcmp".
For exmaple, using "strcmp" to compare two Chinese uincode string,
depending on what rule can "PHP" decide one string is greater or less
than the other string?


If you use strcmp, it'll just do a comparison of the (presumably UTF-8)
encoding, which will have nothing to do with the characters themselves.

See http://www.unicode.org/reports/tr10/ for details on sorting Unicode
strings, but I don't think PHP has an implementation of this.

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #3

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

Similar topics

6
by: Shane Peck | last post by:
I am having a problem using the strcmp function. If I debug my program from within Visual C++, strcmp returns 0 as I want, but if I build the project and then try and execute it, it seems to think...
11
by: xuatla | last post by:
Hi, I want to compare two strings regardless of the lowercase or uppercase. For example, "txt" same as "TXT", "Txt", ... I know that there's stricmp in some c++ that can perform a lowercase...
3
by: jl_post | last post by:
Hi, I recently wrote two benchmark programs that compared if two strings were equal: one was a C program that used C char arrays with strcmp(), and the other was a C++ program that used...
12
by: David W. Thorell | last post by:
I am trying to write a basic spell check function, one which has as its parameters two strings arrays, one is an article from a file source which needs to be checked for valid words, in this case...
7
by: theBestFriend | last post by:
If I type in the vualue && from the standard input and store it into myInputString variable, I expected that expression if(myInputString == "&&") will evaluate to true, but it doesn't. Can you...
3
by: ern | last post by:
//I used strtok() like this: fgets(userCommand, MAX_COMMAND_SIZE, stdin); g_UserCommands = strtok(command, " "); while(g_UserCommands != NULL){ i+=1; g_UserCommands = strtok(NULL, " "); } ...
9
by: Steven | last post by:
Hello, I have a question about strcmp(). I have four words, who need to be compared if it were two strings. I tried adding the comparison values like '(strcmp(w1, w2) + strcmp(w3, w4))', where...
1
by: gemacjr1201 | last post by:
I need hints for an algorithm using string compare in a selection sort. I will be sorting lastnames and first namesalphbetically. if the selection sort encounters the same last name it then goes to...
2
by: nagendrabk | last post by:
can anyone help me with the comparing of the strings program without using strcmp library function in c
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: 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...
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
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.