JBZoo\Utils\Str::trim PHP Method

trim() public static method

Trim whitespaces and other special chars
public static trim ( string $value, boolean $extendMode = false ) : string
$value string
$extendMode boolean
return string
    public static function trim($value, $extendMode = false)
    {
        $result = (string) trim($value);
        if ($extendMode) {
            $result = trim($result, chr(0xe3) . chr(0x80) . chr(0x80));
            $result = trim($result, chr(0xc2) . chr(0xa0));
            $result = trim($result);
        }
        return $result;
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Create iframe.
  *
  * @param string $src
  * @param string $class
  * @param string $id
  * @param array $attrs
  * @return string
  */
 public function render($src, $class = '', $id = '', array $attrs = array())
 {
     $attrs = array_merge(array('frameborder' => 0, 'content' => null, 'tag' => 'iframe', 'src' => Str::trim($src)), $attrs);
     $attrs = $this->_cleanAttrs($attrs);
     $content = $attrs['content'];
     unset($attrs['content']);
     return Html::_('tag')->render($content, Str::trim($class), Str::trim($id), $attrs);
 }
All Usage Examples Of JBZoo\Utils\Str::trim