| @@ 253-261 (lines=9) @@ | ||
| 250 | * |
|
| 251 | * @return \BuildR\Utils\StringObject |
|
| 252 | */ |
|
| 253 | public function first($charCount) { |
|
| 254 | if($charCount <= 0) { |
|
| 255 | return $this->createClone(''); |
|
| 256 | } |
|
| 257 | ||
| 258 | $newValue = $this->substring(0, (int) $charCount); |
|
| 259 | ||
| 260 | return $this->createClone($newValue); |
|
| 261 | } |
|
| 262 | ||
| 263 | /** |
|
| 264 | * Returns the last X character from the current string |
|
| @@ 270-278 (lines=9) @@ | ||
| 267 | * |
|
| 268 | * @return \BuildR\Utils\StringObject |
|
| 269 | */ |
|
| 270 | public function last($charCount) { |
|
| 271 | if($charCount <= 0) { |
|
| 272 | return $this->createClone(''); |
|
| 273 | } |
|
| 274 | ||
| 275 | $newValue = $this->substring(($charCount * -1)); |
|
| 276 | ||
| 277 | return $this->createClone($newValue); |
|
| 278 | } |
|
| 279 | ||
| 280 | /** |
|
| 281 | * Iterates over parts of the string. The current string split through |
|