Skip to content

Commit

Permalink
Add description.
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyDune committed May 17, 2018
1 parent 2856b92 commit ef84fd1
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,47 @@ $instance->replace($string); // equals to 'Gogoriki go swim'
Print formatted string if it is not empty.

```php

$string = 'I know words: #it:printf(«%s»):addcomma(1)##and_it:printf(«%s»):addcomma(1)# and #and_it_2:printf(«%s»):addcomma(1, 1)#';
$instance = new PowerReplace();
$instance->it = 'eat';
$instance->and_it_2 = 'sleep';
$instance->replace($string); // equals to I know words: «eat» and «sleep»
```

### plural

Pluralize the title for number.
```php
$string = 'I see #count# #count:plural(man, men)#';
$instance = new PowerReplace();
$instance->count = 1;
$instance->replace($string); // I see 1 man
$instance->count = 21;
$instance->replace($string); // I see 21 men
```


### pluralrus

Russian pluralize the title for number.
```php
$string = 'У меня есть #count# #count:pluralrus(яблоко, яблока, яблок)#';
$instance = new PowerReplace();

$instance->count = 1;
$instance->replace($string)); // У меня есть 1 яблоко

$instance->count = 21;
$instance->replace($string); // У меня есть 21 яблоко

$instance->count = 2;
$instance->replace($string); // У меня есть 2 яблока

$instance->count = 5;
$instance->replace($string); // У меня есть 5 яблок
```


## Custom Functions

Yup can add own function with replace rules. Markers and function are nor case sensitive.
Expand Down

0 comments on commit ef84fd1

Please sign in to comment.