From 5de7a8646f8094e2b4ccb9fd273b82eb7d24c75b Mon Sep 17 00:00:00 2001 From: jmdavis Date: Sun, 19 Jun 2011 18:46:11 -0700 Subject: [PATCH] Adjust some of the std.ascii function names to be more descriptive. Given that these functions probably aren't used very often, we'd probably be better of making their names longer and more descriptive as Lars suggested. So, they're now isPrintible, isGraphical, and isPunctuation. --- std/ascii.d | 18 +++++++++--------- std/ctype.d | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/std/ascii.d b/std/ascii.d index 8620bfe0d..1f3c7c0ad 100644 --- a/std/ascii.d +++ b/std/ascii.d @@ -212,7 +212,7 @@ unittest Whether or not $(D c) is a punctuation character. That includes all ASCII characters which are not control characters, letters, digits, or whitespace. +/ -bool isPunct(dchar c) @safe pure nothrow +bool isPunctuation(dchar c) @safe pure nothrow { return c <= 0x7F ? cast(bool)(_ctype[c] & _PNC) : false; } @@ -222,9 +222,9 @@ unittest foreach(dchar c; iota(0, 128)) { if(isControl(c) || isAlphaNum(c) || c == ' ') - assert(!isPunct(c)); + assert(!isPunctuation(c)); else - assert(isPunct(c)); + assert(isPunctuation(c)); } } @@ -233,7 +233,7 @@ unittest Whether or not $(D c) is a printable character other than the space character. +/ -bool isGraph(dchar c) @safe pure nothrow +bool isGraphical(dchar c) @safe pure nothrow { return c <= 0x7F ? cast(bool)(_ctype[c] & (_ALP|_DIG|_PNC)) : false; } @@ -243,9 +243,9 @@ unittest foreach(dchar c; iota(0, 128)) { if(isControl(c) || c == ' ') - assert(!isGraph(c)); + assert(!isGraphical(c)); else - assert(isGraph(c)); + assert(isGraphical(c)); } } @@ -253,7 +253,7 @@ unittest Whether or not $(D c) is a printable character - including the space character. +/ -bool isPrint(dchar c) @safe pure nothrow +bool isPrintable(dchar c) @safe pure nothrow { return c <= 0x7F ? cast(bool)(_ctype[c] & (_ALP|_DIG|_PNC|_BLK)) : false; } @@ -263,9 +263,9 @@ unittest foreach(dchar c; iota(0, 128)) { if(isControl(c)) - assert(!isPrint(c)); + assert(!isPrintable(c)); else - assert(isPrint(c)); + assert(isPrintable(c)); } } diff --git a/std/ctype.d b/std/ctype.d index ea04f8da9..71bca7077 100644 --- a/std/ctype.d +++ b/std/ctype.d @@ -68,7 +68,7 @@ pure int islower(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_LC) : 0; } /** * $(RED Scheduled for deprecation in December 2011. Please use - * $(D std.ascii.isPunct) instead.) + * $(D std.ascii.isPunctuation) instead.) * * Returns !=0 if c is a punctuation character. */ @@ -101,7 +101,7 @@ pure int isxdigit(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_HEX) : 0; } /** * $(RED Scheduled for deprecation in December 2011. Please use - * $(D std.ascii.isGraph) instead.) + * $(D std.ascii.isGraphical) instead.) * * Returns !=0 if c is a printing character except for the space character. */ @@ -109,7 +109,7 @@ pure int isgraph(dchar c) { return (c <= 0x7F) ? _ctype[c] & (_ALP|_DIG|_PNC) : /** * $(RED Scheduled for deprecation in December 2011. Please use - * $(D std.ascii.isPrint) instead.) + * $(D std.ascii.isPrintable) instead.) * * Returns !=0 if c is a printing character including the space character. */