src/mako/utility/Str.php
public static function increment(string $string, int $start = 1, string $separator = '_'): string
	{
		preg_match('/(.+)' . preg_quote($separator) . '([0-9]+)$/', $string, $matches);

		return isset($matches[2]) ? $matches[1] . $separator . ((int) $matches[2] + 1) : $string . $separator . $start;
	}
public static function increment(string $string, int $start = 1, string $separator = '_'): string
	{
		preg_match('/(.+)' . preg_quote($separator) . '([0-9]+)$/', $string, $matches);

		return isset($matches[2]) ? $matches[1] . $separator . ((int) $matches[2] + 1) : $string . $separator . $start;
	}
public static function increment ( string $ string , int $ start = 1 , string $ separator = '_' ) : string { preg_match ( '/(.+)' . preg_quote ( $ separator ) . '([0-9]+)$/' , $ string , $ matches ) ; return isset ( $ matches [ 2 ] ) ? $ matches [ 1 ] . $ separator . ( ( int ) $ matches [ 2 ] + 1 ) : $ string . $ separator . $ start ; }
Increments a string by appending a number to it or increasing the number.

@param  string $string    String to increment
@param  int    $start     Starting number
@param  string $separator Separator
@return string
Increments a string by appending a number to it or increasing the number .