PHP code example of lag / string-utils

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

    

lag / string-utils example snippets




use LAG\Component\StringUtils\StringUtils;

StringUtils::start('War of Stars', 3); // War
StringUtils::end('War of Stars', 3); // ars




use LAG\Component\StringUtils\StringUtils;

StringUtils::endsWith('Jedi', 'i'); // true
StringUtils::endsWith('Jedi', 'edi'); // true
StringUtils::endsWith('Jedi', 'Sith'); // false 
StringUtils::endsWith('Jedi', 'S'); // false 

StringUtils::startsWith('Laser', 'L'); // true
StringUtils::startsWith('Laser', 'Las'); // true
StringUtils::startsWith('Laser', 'Force'); // false
StringUtils::startsWith('Laser', 'F'); // false




use LAG\Component\StringUtils\StringUtils;

StringUtils::camelize('my little jedi'); // returns MyLittleJedi
StringUtils::underscore('my little jedi'); // returns my_little_jedi