mirror of
https://github.com/dlang/phobos.git
synced 2025-05-02 16:10:45 +03:00
Replaced calls to std.string and std.ctype's tolower with their toLower counterparts.
This commit is contained in:
parent
d10ee6c2f6
commit
654f35a677
8 changed files with 16 additions and 16 deletions
|
@ -2723,7 +2723,7 @@ assert(!find(a, 2).empty); // found
|
|||
|
||||
// Case-insensitive find of a string
|
||||
string[] s = [ "Hello", "world", "!" ];
|
||||
assert(!find!("tolower(a) == b")(s, "hello").empty);
|
||||
assert(!find!("toLower(a) == b")(s, "hello").empty);
|
||||
----
|
||||
*/
|
||||
R find(alias pred = "a == b", R, E)(R haystack, E needle)
|
||||
|
@ -6462,7 +6462,7 @@ unittest
|
|||
sort(a);
|
||||
assert(isSorted(a));
|
||||
auto b = rndstuff!(string);
|
||||
sort!("tolower(a) < tolower(b)")(b);
|
||||
sort!("toLower(a) < toLower(b)")(b);
|
||||
assert(isSorted!("toupper(a) < toupper(b)")(b));
|
||||
}
|
||||
|
||||
|
|
|
@ -1324,7 +1324,7 @@ if (isInputRange!Source && /*!isSomeString!Source && */isFloatingPoint!Target)
|
|||
case '-':
|
||||
sign++;
|
||||
p.popFront();
|
||||
if (tolower(p.front) == 'i') goto case 'i';
|
||||
if (toLower(p.front) == 'i') goto case 'i';
|
||||
enforce(!p.empty, bailOut());
|
||||
break;
|
||||
case '+':
|
||||
|
@ -1333,8 +1333,8 @@ if (isInputRange!Source && /*!isSomeString!Source && */isFloatingPoint!Target)
|
|||
break;
|
||||
case 'i': case 'I':
|
||||
p.popFront();
|
||||
if (tolower(p.front) == 'n' &&
|
||||
(p.popFront(), tolower(p.front) == 'f') &&
|
||||
if (toLower(p.front) == 'n' &&
|
||||
(p.popFront(), toLower(p.front) == 'f') &&
|
||||
(p.popFront(), p.empty))
|
||||
{
|
||||
// 'inf'
|
||||
|
|
|
@ -32653,7 +32653,7 @@ unittest
|
|||
+/
|
||||
Month monthFromString(string monthStr)
|
||||
{
|
||||
switch(tolower(monthStr))
|
||||
switch(toLower(monthStr))
|
||||
{
|
||||
case "january":
|
||||
case "jan":
|
||||
|
|
|
@ -2087,7 +2087,7 @@ abstract class EncodingScheme
|
|||
throw new EncodingException("Unable to create class "~className);
|
||||
foreach(encodingName;scheme.names())
|
||||
{
|
||||
supported[tolower(encodingName)] = className;
|
||||
supported[toLower(encodingName)] = className;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2105,7 +2105,7 @@ abstract class EncodingScheme
|
|||
*/
|
||||
static EncodingScheme create(string encodingName)
|
||||
{
|
||||
auto p = std.string.tolower(encodingName) in supported;
|
||||
auto p = std.string.toLower(encodingName) in supported;
|
||||
if (p is null)
|
||||
throw new EncodingException("Unrecognized Encoding: "~encodingName);
|
||||
string className = *p;
|
||||
|
|
|
@ -114,7 +114,7 @@ JSONValue parseJSON(T)(T json, int maxDepth = -1) if(isInputRange!T) {
|
|||
void checkChar(bool SkipWhitespace = true, bool CaseSensitive = true)(char c) {
|
||||
static if(SkipWhitespace) skipWhitespace();
|
||||
auto c2 = getChar();
|
||||
static if(!CaseSensitive) c2 = tolower(c2);
|
||||
static if(!CaseSensitive) c2 = toLower(c2);
|
||||
|
||||
if(c2 != c) error(text("Found '", c2, "' when expecting '", c, "'."));
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ JSONValue parseJSON(T)(T json, int maxDepth = -1) if(isInputRange!T) {
|
|||
{
|
||||
static if(SkipWhitespace) skipWhitespace();
|
||||
auto c2 = peekChar();
|
||||
static if (!CaseSensitive) c2 = tolower(c2);
|
||||
static if (!CaseSensitive) c2 = toLower(c2);
|
||||
|
||||
if(c2 != c) return false;
|
||||
|
||||
|
|
|
@ -2047,10 +2047,10 @@ sizediff_t lastIndexOf(Char1, Char2)(in Char1[] s, const(Char2)[] sub,
|
|||
return std.string.lastIndexOf(s, c, cs);
|
||||
if (c <= 0x7F)
|
||||
{
|
||||
c = std.ctype.tolower(c);
|
||||
c = std.ctype.toLower(c);
|
||||
for (ptrdiff_t i = s.length - sub.length; i >= 0; i--)
|
||||
{
|
||||
if (std.ctype.tolower(s[i]) == c)
|
||||
if (std.ctype.toLower(s[i]) == c)
|
||||
{
|
||||
if (icmp(s[i + 1 .. i + sub.length], sub[1 .. sub.length]) == 0)
|
||||
return i;
|
||||
|
|
|
@ -2956,7 +2956,7 @@ private:
|
|||
c = prog[i + 1];
|
||||
if (c <= 0x7F)
|
||||
{ r.setbit2(c);
|
||||
r.setbit2(std.ctype.tolower(cast(rchar)c));
|
||||
r.setbit2(std.ctype.toLower(cast(rchar)c));
|
||||
}
|
||||
return 1;
|
||||
|
||||
|
@ -2983,7 +2983,7 @@ private:
|
|||
debug(regexp) printf("\tREistring %d, '%c'\n", len, c);
|
||||
if (c <= 0x7F)
|
||||
{ r.setbit2(std.ctype.toupper(cast(rchar)c));
|
||||
r.setbit2(std.ctype.tolower(cast(rchar)c));
|
||||
r.setbit2(std.ctype.toLower(cast(rchar)c));
|
||||
}
|
||||
return 1;
|
||||
|
||||
|
|
|
@ -2959,7 +2959,7 @@ bool isNumeric(const(char)[] s, in bool bAllowSep = false)
|
|||
bool bDecimalPoint = false;
|
||||
bool bExponent = false;
|
||||
bool bComplex = false;
|
||||
auto sx = std.string.tolower(s);
|
||||
auto sx = std.string.toLower(s);
|
||||
int j = 0;
|
||||
char c;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue