@@ -203,7 +203,10 @@ Methods to Change Case
203
203
::
204
204
205
205
// changes all graphemes/code points to lower case
206
- u('FOO Bar')->lower(); // 'foo bar'
206
+ u('FOO Bar Brİan')->lower(); // 'foo bar bri̇an'
207
+ // changes all graphemes/code points to lower case according to locale-specific case mappings
208
+ u('FOO Bar Brİan')->localeLower('en'); // 'foo bar bri̇an'
209
+ u('FOO Bar Brİan')->localeLower('lt'); // 'foo bar bri̇̇an'
207
210
208
211
// when dealing with different languages, uppercase/lowercase is not enough
209
212
// there are three cases (lower, upper, title), some characters have no case,
@@ -213,11 +216,17 @@ Methods to Change Case
213
216
u('Die O\'Brian Straße')->folded(); // "die o'brian strasse"
214
217
215
218
// changes all graphemes/code points to upper case
216
- u('foo BAR')->upper(); // 'FOO BAR'
219
+ u('foo BAR bάz')->upper(); // 'FOO BAR BΆZ'
220
+ // changes all graphemes/code points to upper case according to locale-specific case mappings
221
+ u('foo BAR bάz')->localeUpper('en'); // 'FOO BAR BΆZ'
222
+ u('foo BAR bάz')->localeUpper('el'); // 'FOO BAR BAZ'
217
223
218
224
// changes all graphemes/code points to "title case"
219
- u('foo bar')->title(); // 'Foo bar'
220
- u('foo bar')->title(true); // 'Foo Bar'
225
+ u('foo ijssel ')->title(); // 'Foo ijssel'
226
+ u('foo ijssel')->title(true); // 'Foo Ijssel'
227
+ // changes all graphemes/code points to "title case" according to locale-specific case mappings
228
+ u('foo ijssel')->localeTitle('en'); // 'Foo ijssel'
229
+ u('foo ijssel')->localeTitle('nl'); // 'Foo IJssel'
221
230
222
231
// changes all graphemes/code points to camelCase
223
232
u('Foo: Bar-baz.')->camel(); // 'fooBarBaz'
@@ -226,6 +235,10 @@ Methods to Change Case
226
235
// other cases can be achieved by chaining methods. E.g. PascalCase:
227
236
u('Foo: Bar-baz.')->camel()->title(); // 'FooBarBaz'
228
237
238
+ .. versionadded :: 7.1
239
+ The ``localeLower() ``, ``localeUpper() `` and ``localeTitle() `` methods were
240
+ introduced in Symfony 7.1.
241
+
229
242
The methods of all string classes are case-sensitive by default. You can perform
230
243
case-insensitive operations with the ``ignoreCase() `` method::
231
244
0 commit comments