private int locateParameterIndex(String formatString, int i) {

		char c = formatString.charAt(i);
		if (c == '%' || c == '*') {
			++i;
			c = formatString.charAt(i);
		}
		else {
			return 0;
		}
		String paramIndexString = "";
		while (Character.isDigit(c)) {
			paramIndexString += Character.toString(c);
			++i;
			c = formatString.charAt(i);
		}
		return c != '$' || paramIndexString.length() == 0 || Integer.parseInt(paramIndexString) == 0
				? 0
				: Integer.parseInt(paramIndexString);
	}
In a format string with format argument parameters, retrieve that parameter.
In other words, in the following cases: "%n$" and "*n$", return n where n is
the index of the referred argument. n cannot be less than 1; return 0 if
there's a problem.

@param formatString format String
@param i      index within formatStr
@return formar argument parameter
Ghidra/Features/DecompilerDependent/src/main/java/ghidra/app/plugin/core/string/variadic/FormatStringParser.java