mirror of
https://github.com/danielstjules/Stringy.git
synced 2025-09-02 01:22:37 +02:00
Add StaticStringy::hasUpperCase, StaticStringy::hasLowerCase, Stringy->hasUpperCase and Stringy->hasLowerCase along with tests.
This commit is contained in:
@@ -747,6 +747,18 @@ class StaticStringy
|
||||
return Stringy::create($str, $encoding)->isLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the given string has any lower case characters in it.
|
||||
*
|
||||
* @param string $str String to check
|
||||
* @param string $encoding The character encoding
|
||||
* @return bool Whether or not $str contains a lower case character.
|
||||
*/
|
||||
public static function hasLowerCase($str, $encoding = null)
|
||||
{
|
||||
return Stringy::create($str, $encoding)->hasLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the string is serialized, false otherwise.
|
||||
*
|
||||
@@ -772,6 +784,18 @@ class StaticStringy
|
||||
return Stringy::create($str, $encoding)->isUpperCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the given string has any upper case characters in it.
|
||||
*
|
||||
* @param string $str String to check
|
||||
* @param string $encoding The character encoding
|
||||
* @return bool Whether or not $str contains an upper case character.
|
||||
*/
|
||||
public static function hasUpperCase($str, $encoding = null)
|
||||
{
|
||||
return Stringy::create($str, $encoding)->hasUpperCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the string contains only hexadecimal chars, false
|
||||
* otherwise.
|
||||
|
@@ -1333,6 +1333,17 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess
|
||||
return $this->matchesPattern('^[[:lower:]]*$');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the string contains a lower case char, false
|
||||
* otherwise.
|
||||
*
|
||||
* @return bool Whether or not the string contains a lower case character.
|
||||
*/
|
||||
public function hasLowerCase()
|
||||
{
|
||||
return $this->matchesPattern('.*[[:lower:]]');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the string contains only lower case chars, false
|
||||
* otherwise.
|
||||
@@ -1344,6 +1355,17 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess
|
||||
return $this->matchesPattern('^[[:upper:]]*$');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the string contains an upper case char, false
|
||||
* otherwise.
|
||||
*
|
||||
* @return bool Whether or not the string contains an upper case character.
|
||||
*/
|
||||
public function hasUpperCase()
|
||||
{
|
||||
return $this->matchesPattern('.*[[:upper:]]');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the string is serialized, false otherwise.
|
||||
*
|
||||
|
Reference in New Issue
Block a user