mirror of
https://github.com/danielstjules/Stringy.git
synced 2025-09-02 01:22:37 +02:00
Added lines
This commit is contained in:
@@ -215,6 +215,22 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess
|
||||
return $chars;
|
||||
}
|
||||
|
||||
/**
|
||||
* Splits on newlines and carriage returns, returning an array of Stringy
|
||||
* objects corresponding to the lines in the string.
|
||||
*
|
||||
* @return Stringy[] An array of Stringy objects
|
||||
*/
|
||||
public function lines()
|
||||
{
|
||||
$array = mb_split('[\r\n]{1,2}', $this->str);
|
||||
for ($i = 0; $i < count($array); $i++) {
|
||||
$array[$i] = static::create($array[$i], $this->encoding);
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the first character of the supplied string to upper case.
|
||||
*
|
||||
|
Reference in New Issue
Block a user