Skip to content

Commit 6999058

Browse files
committed
Doc for maskValue() function
1 parent a8649f0 commit 6999058

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

docs/en/core-libraries/text.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,22 @@ Replaces characters starting at `$offset` for `$length` characters with `$maskCh
465465
If `$length` is `null`, masking continues to the end of the string.
466466
Negative offsets are supported and are calculated from the end of the string.
467467

468+
```php
469+
$creditCardNumber = '4909090909091234';
470+
471+
// Called as TextHelper
472+
echo $this->Text->mask($creditCardNumber, 0, 12, '*');
473+
474+
// Called as Text
475+
use Cake\Utility\Text;
476+
477+
echo Text::mask($creditCardNumber, 0, 12, '*');
478+
```
479+
480+
Output:
481+
482+
************1234
483+
468484
### Text::maskValue()
469485

470486
`method` Cake\\Utility\\Text::**maskValue**(string $string, array $needles, string $maskCharacter = '*'): string
@@ -486,5 +502,4 @@ echo Text::maskValue('4111111111111234', ['411', '112'], '*');
486502
Output:
487503

488504
***11111111***34
489-
490505
<!-- end-text -->

0 commit comments

Comments
 (0)