mirror of
https://github.com/danielstjules/Stringy.git
synced 2025-08-12 16:24:00 +02:00
Document hasLowerCase and hasUpperCase
This commit is contained in:
28
README.md
28
README.md
@@ -26,6 +26,8 @@ PHP 5.3+ and HHVM. Inspired by underscore.string.js.
|
|||||||
* [ensureRight](#ensureright)
|
* [ensureRight](#ensureright)
|
||||||
* [first](#first)
|
* [first](#first)
|
||||||
* [getEncoding](#getencoding)
|
* [getEncoding](#getencoding)
|
||||||
|
* [hasLowerCase](#haslowercase)
|
||||||
|
* [hasUpperCase](#hasuppercase)
|
||||||
* [humanize](#humanize)
|
* [humanize](#humanize)
|
||||||
* [insert](#insert)
|
* [insert](#insert)
|
||||||
* [isAlpha](#isalpha)
|
* [isAlpha](#isalpha)
|
||||||
@@ -405,6 +407,32 @@ Returns the encoding used by the Stringy object.
|
|||||||
S::create('fòô bàř', 'UTF-8')->getEncoding(); // 'UTF-8'
|
S::create('fòô bàř', 'UTF-8')->getEncoding(); // 'UTF-8'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### hasLowerCase
|
||||||
|
|
||||||
|
$stringy->hasLowerCase()
|
||||||
|
|
||||||
|
S::hasLowerCase(string $str [, string $encoding ])
|
||||||
|
|
||||||
|
Returns true if the string contains a lower case char, false otherwise.
|
||||||
|
|
||||||
|
```php
|
||||||
|
S::create('fòô bàř', 'UTF-8')->hasLowerCase();
|
||||||
|
S::hasLowerCase('fòô bàř', 'UTF-8'); // true
|
||||||
|
```
|
||||||
|
|
||||||
|
#### hasUpperCase
|
||||||
|
|
||||||
|
$stringy->hasUpperCase()
|
||||||
|
|
||||||
|
S::hasUpperCase(string $str [, string $encoding ])
|
||||||
|
|
||||||
|
Returns true if the string contains an upper case char, false otherwise.
|
||||||
|
|
||||||
|
```php
|
||||||
|
S::create('fòô bàř', 'UTF-8')->hasUpperCase();
|
||||||
|
S::hasUpperCase('fòô bàř', 'UTF-8'); // false
|
||||||
|
```
|
||||||
|
|
||||||
#### humanize
|
#### humanize
|
||||||
|
|
||||||
$stringy->humanize()
|
$stringy->humanize()
|
||||||
|
@@ -686,6 +686,32 @@ class StaticStringy
|
|||||||
return (string) Stringy::create($str, $encoding)->removeRight($substring);
|
return (string) Stringy::create($str, $encoding)->removeRight($substring);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the string contains a lower case char, false
|
||||||
|
* otherwise.
|
||||||
|
*
|
||||||
|
* @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 contains an upper case char, false
|
||||||
|
* otherwise.
|
||||||
|
*
|
||||||
|
* @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 alphabetic chars, false
|
* Returns true if the string contains only alphabetic chars, false
|
||||||
* otherwise.
|
* otherwise.
|
||||||
@@ -750,18 +776,6 @@ class StaticStringy
|
|||||||
return Stringy::create($str, $encoding)->isLowerCase();
|
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.
|
* Returns true if the string is serialized, false otherwise.
|
||||||
*
|
*
|
||||||
@@ -787,18 +801,6 @@ class StaticStringy
|
|||||||
return Stringy::create($str, $encoding)->isUpperCase();
|
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
|
* Returns true if the string contains only hexadecimal chars, false
|
||||||
* otherwise.
|
* otherwise.
|
||||||
|
@@ -1297,6 +1297,28 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess
|
|||||||
return $match;
|
return $match;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 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 contains only alphabetic chars, false
|
* Returns true if the string contains only alphabetic chars, false
|
||||||
* otherwise.
|
* otherwise.
|
||||||
@@ -1364,17 +1386,6 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess
|
|||||||
return $this->matchesPattern('^[[:lower:]]*$');
|
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
|
* Returns true if the string contains only lower case chars, false
|
||||||
* otherwise.
|
* otherwise.
|
||||||
@@ -1386,17 +1397,6 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess
|
|||||||
return $this->matchesPattern('^[[:upper:]]*$');
|
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.
|
* Returns true if the string is serialized, false otherwise.
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user