ToUpper() ?
|
03-12-2015, 04:19 PM
(This post was last modified: 03-12-2015 04:58 PM by Claudio L..)
Post: #19
|
|||
|
|||
RE: ToUpper() ?
(03-10-2015 06:28 AM)cyrille de brébisson Wrote: Hello, Here's my solution in C (somebody can translate to Prime? Han perhaps?). These tables were prepared by me based on the Unicode standard, with help from a public document about case folding. I did it a few years back, so they might have added more symbols/ranges afterwards. Code:
Each table entry has the start and end codes of a range, and an offset value. If your character is within that range (both ends included), you need to add the offset to obtain the equivalent lowercase character (this table is for case-folding = tolower()). To be used for toupper(), you should simply add the offset to the start and end values to get the lowercase range, check if your character is within, and subtract the offset instead of adding it. EDIT: Forgot to mention, when the offset is 1, the uppercase and lowercase symbols are alternated. See the example code below. There's actually 2 tables. One for 16-bit unicode values and the second one for 32-bit unicode characters (there's only one range defined in 32-bits that can be folded). Code:
I'll leave it for the Prime gurus to make a proper Unicode compliant ToUpper() and ToLower(). In C the tables are only 1400 bytes, not sure how much space you need on the Prime. It's not the fastest, but it's the most embeddable method I could find. Feel free to use it. Claudio |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
ToUpper() ? - Angus - 03-09-2015, 01:02 PM
RE: ToUpper() ? - Thomas_Sch - 03-09-2015, 06:41 PM
RE: ToUpper() ? - PANAMATIK - 03-09-2015, 07:50 PM
RE: ToUpper() ? - Mark Hardman - 03-09-2015, 08:25 PM
RE: ToUpper() ? - jebem - 03-09-2015, 08:45 PM
RE: ToUpper() ? - Angus - 03-10-2015, 06:27 AM
RE: ToUpper() ? - cyrille de brébisson - 03-10-2015, 06:28 AM
RE: ToUpper() ? - Claudio L. - 03-12-2015 04:19 PM
RE: ToUpper() ? - Didier Lachieze - 03-10-2015, 07:51 AM
RE: ToUpper() ? - Thomas_Sch - 03-10-2015, 08:10 AM
RE: ToUpper() ? - Angus - 03-10-2015, 08:10 AM
RE: ToUpper() ? - Didier Lachieze - 03-10-2015, 08:34 AM
RE: ToUpper() ? - Angus - 03-10-2015, 08:26 AM
RE: ToUpper() ? - Angus - 03-10-2015, 09:16 AM
RE: ToUpper() ? - Didier Lachieze - 03-10-2015, 12:12 PM
RE: ToUpper() ? - Tim Wessman - 03-10-2015, 12:55 PM
RE: ToUpper() ? - BruceH - 03-11-2015, 11:44 PM
RE: ToUpper() ? - bobkrohn - 03-12-2015, 06:25 AM
RE: ToUpper() ? - cyrille de brébisson - 03-12-2015, 03:49 PM
RE: ToUpper() ? - bobkrohn - 03-12-2015, 04:44 PM
RE: ToUpper() ? - Didier Lachieze - 03-12-2015, 04:53 PM
RE: ToUpper() ? - bobkrohn - 03-12-2015, 08:05 PM
RE: ToUpper() ? - DrD - 03-12-2015, 08:44 PM
RE: ToUpper() ? - cyrille de brébisson - 03-13-2015, 06:18 AM
RE: ToUpper() ? - bobkrohn - 03-13-2015, 11:28 PM
RE: ToUpper() ? - DrD - 03-14-2015, 04:45 AM
RE: ToUpper() ? - cyrille de brébisson - 03-17-2015, 07:11 AM
|
User(s) browsing this thread: 1 Guest(s)