@@ 281-289 (lines=9) @@ | ||
278 | * |
|
279 | * @return \BuildR\Utils\StringObject |
|
280 | */ |
|
281 | public function first($charCount) { |
|
282 | if($charCount <= 0) { |
|
283 | return $this->createClone(''); |
|
284 | } |
|
285 | ||
286 | $newValue = $this->substring(0, (int) $charCount); |
|
287 | ||
288 | return $this->createClone($newValue); |
|
289 | } |
|
290 | ||
291 | /** |
|
292 | * Returns the last X character from the current string |
|
@@ 298-306 (lines=9) @@ | ||
295 | * |
|
296 | * @return \BuildR\Utils\StringObject |
|
297 | */ |
|
298 | public function last($charCount) { |
|
299 | if($charCount <= 0) { |
|
300 | return $this->createClone(''); |
|
301 | } |
|
302 | ||
303 | $newValue = $this->substring(($charCount * -1)); |
|
304 | ||
305 | return $this->createClone($newValue); |
|
306 | } |
|
307 | ||
308 | /** |
|
309 | * Iterates over parts of the string. The current string split through |