Results 1 to 5 of 5

Thread: how to locale compare two string ?

  1. #1
    Join Date
    Aug 2011
    Posts
    4
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default how to locale compare two string ?

    I want to compare two latin qstring
    like that:
    compare("â","e",locale(a certain country)) return ( e > â in latin character)
    thank a lot
    sorry for my stupid english . I can't express my thoughts clearly
    Last edited by narutokage; 13th August 2011 at 16:11.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: how to locale compare two string ?

    In the ISO 8859-1 (Latin 1) character set ('e' > 'â') is false. Are you saying that you want à , á, â, ã, ä, and å to be treated as if they were 'a' for comparison ?

  3. The following user says thank you to ChrisW67 for this useful post:

    narutokage (16th August 2011)

  4. #3
    Join Date
    Aug 2011
    Posts
    4
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Re: how to locale compare two string ?

    Quote Originally Posted by ChrisW67 View Post
    In the ISO 8859-1 (Latin 1) character set ('e' > 'â') is false. Are you saying that you want à , á, â, ã, ä, and å to be treated as if they were 'a' for comparison ?
    thank for reply !!
    but. I want to make a international dictionary. I use binary search and It need:
    Performing Locale-Independent Comparisons (in java)
    http://download.oracle.com/javase/tu...xt/locale.html

    this feature is so great. You can apply to many algorithms (sort,search.....)
    so what is like that in QT ?
    Last edited by narutokage; 16th August 2011 at 07:01.

  5. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: how to locale compare two string ?

    Is QString::localeAwareCompare() what you are looking for?

  6. The following user says thank you to ChrisW67 for this useful post:

    narutokage (16th August 2011)

  7. #5
    Join Date
    Aug 2011
    Posts
    4
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Re: how to locale compare two string ?

    Quote Originally Posted by ChrisW67 View Post
    Is QString::localeAwareCompare() what you are looking for?
    thank !!
    but I am not sure, may you give me a short example ??
    Last edited by narutokage; 16th August 2011 at 09:19.

Similar Threads

  1. How to change locale
    By memus in forum Newbie
    Replies: 5
    Last Post: 29th May 2011, 12:50
  2. About locale issue
    By xiajingan in forum Qt Programming
    Replies: 3
    Last Post: 26th February 2009, 21:18
  3. Setting locale for the whole app
    By maverick_pol in forum Qt Programming
    Replies: 2
    Last Post: 22nd June 2008, 22:53
  4. Compare
    By merry in forum Qt Programming
    Replies: 1
    Last Post: 14th March 2007, 15:03
  5. Qt4 and system locale
    By L.Marvell in forum Qt Programming
    Replies: 9
    Last Post: 15th January 2007, 13:00

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.