Results 1 to 3 of 3

Thread: QString checking whether in ASCII range

  1. #1
    Join Date
    Apr 2011
    Location
    Hyderabad, India
    Posts
    25
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QString checking whether in ASCII range

    I have a QString as input. The string may contain Unicode text as well. I want to check whether a character is in Extended ASCII range (0-255). How to do this...pls help

  2. #2
    Join Date
    Nov 2010
    Posts
    315
    Thanked 53 Times in 51 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QString checking whether in ASCII range

    Last edited by MarekR22; 29th April 2011 at 15:45.

  3. #3
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QString checking whether in ASCII range

    I want to check whether a character is in Extended ASCII range (0-255).
    So I guess you mean you want to know if a char value is greater than 127, since below that its not extended ascii.
    Iterating over the string char by char as Mark suggested is not very efficient, specially for larger strings.
    You can use QRegExp to match all char above 127 with \\0x80-\\0x255.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Replies: 8
    Last Post: 14th April 2010, 05:54
  2. ASCII to int and int to ASCII
    By askbapi in forum Newbie
    Replies: 2
    Last Post: 31st March 2010, 22:36
  3. ASCII to PDF
    By jaca in forum Newbie
    Replies: 3
    Last Post: 19th September 2009, 23:51
  4. Replies: 4
    Last Post: 31st January 2008, 20:44

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.