String (@NotNull String attributeName) { char[] toReplace = {'$', '-', '+', ':'}; StringBuilder builder = new StringBuilder(attributeName.length()); for (int i = 0; i < attributeName.length(); i++) { char c = attributeName.charAt(i); boolean replaced = false; for (char aToReplace : toReplace) { if (c == aToReplace) { builder.append('_'); replaced = true; break; } } if (!replaced) { builder.append(c); } } return builder.toString(); }