1. Go to this page and download the library: Download tcb13/substringy library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tcb13 / substringy example snippets
use SubStringy\SubStringy as S;
use Stringy\Stringy as S;
echo S::create('Fòô Bàř', 'UTF-8')->collapseWhitespace()->swapCase(); // 'fÒÔ bÀŘ'
namespace Vendor\YourPackage;
use Stringy\Stringy;
use SubStringy\SubStringyTrait;
use SliceableStringy\SliceableStringyTrait;
class MyStringy extends Stringy
{
use SubStringyTrait;
use SliceableStringyTrait;
}
use YourPackage\MyStringy as S;
$sliceableSubstring = S::create('What are your plans today?')->substringAfterFirst('plans ');
echo $sliceableSubstring['4:6'];
S::create('What are your plans today?')->substringAfterFirst('plans ');
S::create('This is a String. How cool can a String be after all?')->substringAfterLast('String ');
S::create('What are your plans today?')->substringBeforeFirst(' plans');
S::create('What are your plans today? Any plans for tomorrow?')->substringBeforeLast(' plans');
S::create('What are your plans today?')->substringBetween('your ', ' today');
S::create('how are you? are you sure you are ok?')->substringCount('are');