Skip to content

Commit 486c967

Browse files
OskarStarkjaviereguiluz
authored andcommitted
[String] add named arguments
1 parent d670e01 commit 486c967

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

components/string.rst

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ Methods to Change Case
217217

218218
// changes all graphemes/code points to "title case"
219219
u('foo bar')->title(); // 'Foo bar'
220-
u('foo bar')->title(true); // 'Foo Bar'
220+
u('foo bar')->title(allWords: true); // 'Foo Bar'
221221

222222
// changes all graphemes/code points to camelCase
223223
u('Foo: Bar-baz.')->camel(); // 'fooBarBaz'
@@ -255,20 +255,20 @@ Methods to Append and Prepend
255255
u('UserControllerController')->ensureEnd('Controller'); // 'UserController'
256256

257257
// returns the contents found before/after the first occurrence of the given string
258-
u('hello world')->before('world'); // 'hello '
259-
u('hello world')->before('o'); // 'hell'
260-
u('hello world')->before('o', true); // 'hello'
258+
u('hello world')->before('world'); // 'hello '
259+
u('hello world')->before('o'); // 'hell'
260+
u('hello world')->before('o', includeNeedle: true); // 'hello'
261261

262-
u('hello world')->after('hello'); // ' world'
263-
u('hello world')->after('o'); // ' world'
264-
u('hello world')->after('o', true); // 'o world'
262+
u('hello world')->after('hello'); // ' world'
263+
u('hello world')->after('o'); // ' world'
264+
u('hello world')->after('o', includeNeedle: true); // 'o world'
265265

266266
// returns the contents found before/after the last occurrence of the given string
267-
u('hello world')->beforeLast('o'); // 'hello w'
268-
u('hello world')->beforeLast('o', true); // 'hello wo'
267+
u('hello world')->beforeLast('o'); // 'hello w'
268+
u('hello world')->beforeLast('o', includeNeedle: true); // 'hello wo'
269269

270-
u('hello world')->afterLast('o'); // 'rld'
271-
u('hello world')->afterLast('o', true); // 'orld'
270+
u('hello world')->afterLast('o'); // 'rld'
271+
u('hello world')->afterLast('o', includeNeedle: true); // 'orld'
272272

273273
Methods to Pad and Trim
274274
~~~~~~~~~~~~~~~~~~~~~~~
@@ -381,17 +381,17 @@ Methods to Join, Split, Truncate and Reverse
381381
u('Lorem Ipsum')->truncate(80); // 'Lorem Ipsum'
382382
// the second argument is the character(s) added when a string is cut
383383
// (the total length includes the length of this character(s))
384-
u('Lorem Ipsum')->truncate(8, '…'); // 'Lorem I…'
384+
u('Lorem Ipsum')->truncate(8, '…'); // 'Lorem I…'
385385
// if the third argument is false, the last word before the cut is kept
386386
// even if that generates a string longer than the desired length
387-
u('Lorem Ipsum')->truncate(8, '…', false); // 'Lorem Ipsum'
387+
u('Lorem Ipsum')->truncate(8, '…', cut: false); // 'Lorem Ipsum'
388388

389389
::
390390

391391
// breaks the string into lines of the given length
392-
u('Lorem Ipsum')->wordwrap(4); // 'Lorem\nIpsum'
392+
u('Lorem Ipsum')->wordwrap(4); // 'Lorem\nIpsum'
393393
// by default it breaks by white space; pass TRUE to break unconditionally
394-
u('Lorem Ipsum')->wordwrap(4, "\n", true); // 'Lore\nm\nIpsu\nm'
394+
u('Lorem Ipsum')->wordwrap(4, "\n", cut: true); // 'Lore\nm\nIpsu\nm'
395395

396396
// replaces a portion of the string with the given contents:
397397
// the second argument is the position where the replacement starts;
@@ -405,7 +405,7 @@ Methods to Join, Split, Truncate and Reverse
405405
u('0123456789')->chunk(3); // ['012', '345', '678', '9']
406406

407407
// reverses the order of the string contents
408-
u('foo bar')->reverse(); // 'rab oof'
408+
u('foo bar')->reverse(); // 'rab oof'
409409
u('さよなら')->reverse(); // 'らなよさ'
410410

411411
Methods Added by ByteString

0 commit comments

Comments
 (0)