fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.regex.*;
  4.  
  5. /* Name of the class has to be "Main" only if the class is public. */
  6. class Ideone
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. String str = "Jos\\u00e9_A\\u002e_Santos";
  11. Matcher matcher = Pattern.compile("\\\\u([^_]+)").matcher(str);
  12. while (matcher.find()) {
  13. matcher.appendReplacement(sb, "\\\\\\$" + matcher.group(1).toUpperCase());
  14. }
  15. matcher.appendTail(sb);
  16. System.out.println("The original string " + str + "\n has been converted " + sb.toString());
  17. }
  18. }
Success #stdin #stdout 0.06s 380224KB
stdin
Standard input is empty
stdout
The original string Jos\u00e9_A\u002e_Santos
 has been converted Jos\$00E9_A\$002E_Santos