Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions components/string.rst
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,11 @@ Methods to Search and Replace
u('avatar-73647.png')->match('/avatar-(\d+)\.png/');
// result = ['avatar-73647.png', '73647']

// checks if the string contains any of the other given strings
u('aeiou')->containsAny('a'); // true
u('aeiou')->containsAny(['ab', 'efg']); // false
u('aeiou')->containsAny(['eio', 'foo', 'z']); // true

// finds the position of the first occurrence of the given string
// (the second argument is the position where the search starts and negative
// values have the same meaning as in PHP functions)
Expand Down Expand Up @@ -327,6 +332,10 @@ Methods to Search and Replace
return '['.$match[0].']';
}); // result = '[1][2][3]'

.. versionadded:: 5.1

The ``containsAny()`` method was introduced in Symfony 5.1.

Methods to Join, Split, Truncate and Reverse
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down