| @@ 2251-2266 (lines=16) @@ | ||
| 2248 | * | |
| 2249 | * @return Stringy | |
| 2250 | */ | |
| 2251 | public function afterFirst($separator) | |
| 2252 |   { | |
| 2253 |     if (($offset = $this->indexOf($separator)) === false) { | |
| 2254 |       return static::create(''); | |
| 2255 | } | |
| 2256 | ||
| 2257 | return static::create( | |
| 2258 | UTF8::substr( | |
| 2259 | $this->str, | |
| 2260 | $offset + UTF8::strlen($separator, $this->encoding), | |
| 2261 | null, | |
| 2262 | $this->encoding | |
| 2263 | ), | |
| 2264 | $this->encoding | |
| 2265 | ); | |
| 2266 | } | |
| 2267 | ||
| 2268 | /** | |
| 2269 | * Gets the substring after the last occurrence of a separator. | |
| @@ 2302-2318 (lines=17) @@ | ||
| 2299 | * | |
| 2300 | * @return Stringy | |
| 2301 | */ | |
| 2302 | public function beforeFirst($separator) | |
| 2303 |   { | |
| 2304 | $offset = $this->indexOf($separator); | |
| 2305 |     if ($offset === false) { | |
| 2306 |       return static::create('', $this->encoding); | |
| 2307 | } | |
| 2308 | ||
| 2309 | return static::create( | |
| 2310 | UTF8::substr( | |
| 2311 | $this->str, | |
| 2312 | 0, | |
| 2313 | $offset, | |
| 2314 | $this->encoding | |
| 2315 | ), | |
| 2316 | $this->encoding | |
| 2317 | ); | |
| 2318 | } | |
| 2319 | ||
| 2320 | /** | |
| 2321 | * Gets the substring before the last occurrence of a separator. | |
| @@ 2328-2344 (lines=17) @@ | ||
| 2325 | * | |
| 2326 | * @return Stringy | |
| 2327 | */ | |
| 2328 | public function beforeLast($separator) | |
| 2329 |   { | |
| 2330 | $offset = $this->indexOfLast($separator); | |
| 2331 |     if ($offset === false) { | |
| 2332 |       return static::create('', $this->encoding); | |
| 2333 | } | |
| 2334 | ||
| 2335 | return static::create( | |
| 2336 | UTF8::substr( | |
| 2337 | $this->str, | |
| 2338 | 0, | |
| 2339 | $offset, | |
| 2340 | $this->encoding | |
| 2341 | ), | |
| 2342 | $this->encoding | |
| 2343 | ); | |
| 2344 | } | |
| 2345 | ||
| 2346 | /** | |
| 2347 | * Returns the string with the first letter of each word capitalized, | |