inc() public static méthode

Used to easily create distinct labels when copying objects. The method has the following styles: - default: "Label" becomes "Label (2)" - dash: "Label" becomes "Label-2"
public static inc ( string $string, string $style = 'default', integer $next ) : string
$string string The source string.
$style string The the style (default|dash).
$next integer If supplied, this number is used for the copy, otherwise it is the 'next' number.
Résultat string
Exemple #1
0
 public function testInc()
 {
     isSame('title (2)', Str::inc('title', null, 0));
     isSame('title(3)', Str::inc('title(2)', null, 0));
     isSame('title-2', Str::inc('title', 'dash', 0));
     isSame('title-3', Str::inc('title-2', 'dash', 0));
     isSame('title (4)', Str::inc('title', null, 4));
     isSame('title (2)', Str::inc('title', 'foo', 0));
 }