Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/maximo-perez-villalba/tool-txt

La clase TXT agrupa herramientas para trabajar sobre texto al estilo navaja suiza.
https://github.com/maximo-perez-villalba/tool-txt

cutter library php php7 phpunit phpunit-tests string tool toolkit txt

Last synced: 12 days ago
JSON representation

La clase TXT agrupa herramientas para trabajar sobre texto al estilo navaja suiza.

Awesome Lists containing this project

README

        

# tool-txt
La clase TXT agrupa herramientas para trabajar sobre texto al estilo navaja suiza.

## Tools:
### startWith
```php
$txt = TXT::create( "Lorem ipsum..." );
$txt->startWith('Lorem '); //TRUE
```

### endWith
```php
TXT::create( "Lorem ipsum..." )->endWith('...'); //TRUE
```

### equals
```php
$text = $otherText = 'Lorem ipsum...';
TXT::create($text)->equals($otherText); //TRUE
```

### compare
Comparación de string segura a nivel binario.
Devuelve < 0 si $ext es menor que $therText; > 0 si $text es mayor que $otherText y 0 si son iguales.
@see https://www.php.net/manual/es/function.strcmp.php
```php
$text = $otherText = 'Lorem ipsum...';
TXT::create($text)->compare($otherText) === 0; //TRUE
```

### contains
```php
TXT::create('Lorem ipsum...')->contains('rem ip'); //TRUE
```

### lastPart
```php
TXT::create('Lorem|ipsum')->lastPart('|'); //ipsum
TXT::create('Lorem|ipsum')->lastPart('|', TRUE); //|ipsum
```

### firstPart
```php
TXT::create('Lorem|ipsum')->firstPart('|'); //Lorem
TXT::create('Lorem|ipsum')->firstPart('|', TRUE); //Lorem|
```

### toCamelCaseClass
```php
TXT::create('mAke_mE camel-case pLEase')->toCamelCaseClass() == 'MakeMeCamelCasePlease'; //TRUE
```

### toCamelCaseVariable
```php
TXT::create('MAke_mE camel-case pLEase')->toCamelCaseVariable() == 'makeMeCamelCasePlease'; //TRUE
```