String (PsiExpression[] arguments, int indexOfFormatString, CommentTracker commentTracker) { final StringBuilder builder = new StringBuilder(); String value = (String)ExpressionUtils.computeConstantExpression(arguments[indexOfFormatString]); assert value != null; value = value.replace("%%", "%"); int start = 0; int end = value.indexOf("%s"); int count = 0; while (end >= 0) { if (end > start) { if (builder.length() > 0) { builder.append('+'); } builder.append('"').append(StringUtil.escapeStringCharacters(value.substring(start, end))).append('"'); } if (builder.length() > 0) { builder.append('+'); } count++; final PsiExpression argument = arguments[indexOfFormatString + count]; if (builder.length() == 0 && !ExpressionUtils.hasStringType(argument)) { builder.append("String.valueOf(").append(commentTracker.text(argument)).append(')'); } else { builder.append(commentTracker.text(argument, ParenthesesUtils.ADDITIVE_PRECEDENCE)); } start = end + 2; end = value.indexOf("%s", start); } if (start < value.length()) { if (builder.length() > 0) { builder.append('+'); } builder.append('"').append(StringUtil.escapeStringCharacters(value.substring(start))).append('"'); } return builder.toString(); }