www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - isalpha for beyond ASCII?

reply James Dunne <james.jdunne gmail.com> writes:
Looking at the isalpha function in std.ctype, it seems it's only 
available for ASCII code support which is fine for most purposes.

However, I'd like to find something a bit more complete than that, 
checking alpha characters (dchars) for languages in say, Greek, Russian, 
Japanese, etc.  Does this make any sense?  Is there anything existing 
out there for D that can handle this job?
Nov 12 2005
next sibling parent reply James Dunne <james.jdunne gmail.com> writes:
James Dunne wrote:
 Looking at the isalpha function in std.ctype, it seems it's only 
 available for ASCII code support which is fine for most purposes.
 
 However, I'd like to find something a bit more complete than that, 
 checking alpha characters (dchars) for languages in say, Greek, Russian, 
 Japanese, etc.  Does this make any sense?  Is there anything existing 
 out there for D that can handle this job?
*browses through dmd/src/dmd ...* *peeks at dmd/src/dmd/unialpha.c* =-O I'll be converting this to D right meow. Any caveats I should be aware of?
Nov 12 2005
parent reply "Charles" <noone nowhere.com> writes:
 I'll be converting this to D right meow.  Any caveats I should be aware
of? Hehe , is that a super trooper reference :) ? "James Dunne" <james.jdunne gmail.com> wrote in message news:dl5cep$9m4$1 digitaldaemon.com...
 James Dunne wrote:
 Looking at the isalpha function in std.ctype, it seems it's only
 available for ASCII code support which is fine for most purposes.

 However, I'd like to find something a bit more complete than that,
 checking alpha characters (dchars) for languages in say, Greek, Russian,
 Japanese, etc.  Does this make any sense?  Is there anything existing
 out there for D that can handle this job?
*browses through dmd/src/dmd ...* *peeks at dmd/src/dmd/unialpha.c* =-O I'll be converting this to D right meow. Any caveats I should be aware
of?
Nov 12 2005
parent James Dunne <james.jdunne gmail.com> writes:
Charles wrote:
I'll be converting this to D right meow.  Any caveats I should be aware
of? Hehe , is that a super trooper reference :) ?
Am I sayin meow?
 "James Dunne" <james.jdunne gmail.com> wrote in message
 news:dl5cep$9m4$1 digitaldaemon.com...
 
James Dunne wrote:

Looking at the isalpha function in std.ctype, it seems it's only
available for ASCII code support which is fine for most purposes.

However, I'd like to find something a bit more complete than that,
checking alpha characters (dchars) for languages in say, Greek, Russian,
Japanese, etc.  Does this make any sense?  Is there anything existing
out there for D that can handle this job?
*browses through dmd/src/dmd ...* *peeks at dmd/src/dmd/unialpha.c* =-O I'll be converting this to D right meow. Any caveats I should be aware
of?
Nov 12 2005
prev sibling parent reply David L. Davis <SpottedTiger yahoo.com> writes:
In article <dl5b96$8m7$1 digitaldaemon.com>, James Dunne says...
Looking at the isalpha function in std.ctype, it seems it's only 
available for ASCII code support which is fine for most purposes.

However, I'd like to find something a bit more complete than that, 
checking alpha characters (dchars) for languages in say, Greek, Russian, 
Japanese, etc.  Does this make any sense?  Is there anything existing 
out there for D that can handle this job?
Hauke Duden's unichar.d that he released in June 2004 has a "bool charIsAlpha(dchar chr)" function that may fit the bill. Here's the release post and a link to the unichar.zip: http://www.digitalmars.com/d/archives/digitalmars/D/3868.html http://www.hazardarea.com/unichar.zip David L. ------------------------------------------------------------------- "Dare to reach for the Stars...Dare to Dream, Build, and Achieve!" ------------------------------------------------------------------- MKoD: http://spottedtiger.tripod.com/D_Language/D_Main_XP.html
Nov 12 2005
next sibling parent reply James Dunne <james.jdunne gmail.com> writes:
David L. Davis wrote:
 In article <dl5b96$8m7$1 digitaldaemon.com>, James Dunne says...
 
Looking at the isalpha function in std.ctype, it seems it's only 
available for ASCII code support which is fine for most purposes.

However, I'd like to find something a bit more complete than that, 
checking alpha characters (dchars) for languages in say, Greek, Russian, 
Japanese, etc.  Does this make any sense?  Is there anything existing 
out there for D that can handle this job?
Hauke Duden's unichar.d that he released in June 2004 has a "bool charIsAlpha(dchar chr)" function that may fit the bill. Here's the release post and a link to the unichar.zip: http://www.digitalmars.com/d/archives/digitalmars/D/3868.html http://www.hazardarea.com/unichar.zip David L. ------------------------------------------------------------------- "Dare to reach for the Stars...Dare to Dream, Build, and Achieve!" ------------------------------------------------------------------- MKoD: http://spottedtiger.tripod.com/D_Language/D_Main_XP.html
Apparently there is also a super-secret hidden feature of phobos... std.uni! There is a nearly identical function in there from the compiler's internal source code called isUniAlpha. In my project, I'm using my own modified version of std.ctype which includes isUniAlpha and combines it with the isalpha, isalnum, etc. functions. Why not provide this functionality in std.ctype by default? std.ctype functions work with dchars anyway...
Nov 12 2005
parent "Walter Bright" <newshound digitalmars.com> writes:
"James Dunne" <james.jdunne gmail.com> wrote in message
news:dl6442$tbj$2 digitaldaemon.com...
 In my project, I'm using my own modified version of std.ctype which
 includes isUniAlpha and combines it with the isalpha, isalnum, etc.
 functions.  Why not provide this functionality in std.ctype by default?
   std.ctype functions work with dchars anyway...
It's not in by default because isalpha() and company tend to be used in highly speed critical applications that often deal only with ASCII. Hence, it makes sense to split it into two functions.
Nov 13 2005
prev sibling parent James Dunne <james.jdunne gmail.com> writes:
David L. Davis wrote:
 In article <dl5b96$8m7$1 digitaldaemon.com>, James Dunne says...
 
Looking at the isalpha function in std.ctype, it seems it's only 
available for ASCII code support which is fine for most purposes.

However, I'd like to find something a bit more complete than that, 
checking alpha characters (dchars) for languages in say, Greek, Russian, 
Japanese, etc.  Does this make any sense?  Is there anything existing 
out there for D that can handle this job?
Hauke Duden's unichar.d that he released in June 2004 has a "bool charIsAlpha(dchar chr)" function that may fit the bill. Here's the release post and a link to the unichar.zip: http://www.digitalmars.com/d/archives/digitalmars/D/3868.html http://www.hazardarea.com/unichar.zip David L. ------------------------------------------------------------------- "Dare to reach for the Stars...Dare to Dream, Build, and Achieve!" ------------------------------------------------------------------- MKoD: http://spottedtiger.tripod.com/D_Language/D_Main_XP.html
Hm! Quite complete, if I do say so. But a bit too complete for my needs, and also comes with its own license with a request for credit. That's cool with me if I had chosen to go with it, but I don't think I need that much. std.uni.isUniAlpha is good enough (plus my own mods). Thanks though!
Nov 13 2005