集册 Java实例教程 字符串替换为unicode

字符串替换为unicode

欢马劈雪     最近更新时间:2020-01-02 10:19:05

583
字符串替换为unicode

public class Main {

  private String jaText = "this is a test ";
  /*
  N o w  J a v a  . c o m
  */



  public Main() {

    String replaced = jaText.replaceFirst("\u6587\u5B57", "mojibake");

    System.out.printf("Replaced: %s\n", replaced);

  }

}