background image

17   Matcher m = Pattern.compile(pStr).matcher(INPUTTEXT);
18
19   if (m.matches()) {
20
21   int bs = Integer.valueOf(m.group("bytes"), 16);
22
23   int c = Integer.valueOf(m.group("char"), 16);
24
25   System.out.printf("[%x] -> [%04x]%n", bs, c);
26
27   }

  或者
1 System.out.println("0x1234 u+5678".replaceFirst(pStr, "u+$ 0x$"));