JString::increment
Increments a trailing number in a string.
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"
Signature
public function increment(string
$string,
[string
$style = 'default',
[integer
$n = 0]] )
Parameters
-
$string
- The source string.
-
$style
- The the style (default|dash).
-
$n
- If supplied, this number is used for the copy, otherwise it is the 'next' number.
Returns
- string
- The incremented string.