PHP code example of pataar / smartstring

1. Go to this page and download the library: Download pataar/smartstring 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/ */

    

pataar / smartstring example snippets


\Pataar\SmartString::create("Sample String");

new \Pataar\SmartString("Sample String");

$sampletext = "Sample String";

echo \Pataar\SmartString::create($sampletext)->remove("String")->trim();
//which would echo "Sample"

echo \Pataar\SmartString::create($sampletext)->prefix("A new ")->normalize();
//which would echo "a-new-sample-string"

echo \Pataar\SmartString::create($sampletext)->toMd5WithSalt("Salting is good");
//which would echo "560fbd0056c4354c5dd0de0580c8c523"

echo \Pataar\SmartString::create($sampletext)->remove("String")->trim()->toLower()->prefix("String ");
//which would echo "String sample"

$smartString->toUpper();

$smartString->toLower();

$smartString->trim();

$smartString->printme();

$smartString->indexOf($input);

$smartString->substring($start, $length);

$smartString->toMd5();

$smartString->toMd5WithSalt($salt);

$smartString->encodeB64();
$smartString->decodeB64();

$smartString->charAt($index);

$smartString->equals($string);

$smartString->prefix($prefix);

$smartString->suffix($suffix);

$smartString->concat($string);

$smartString->replace($search, $replacement);

$smartString->replacePattern($pattern, $replacement);

$smartString->remove($string);

$smartString->length();

$smartString->normalize();