String replace by unicode - Java Language Basics

Java examples for Language Basics:String

Description

String replace by unicode

Demo Code

public class Main {
  private String jaText = "this is a test ";


  public Main() {
    String replaced = jaText.replaceFirst("\u6587\u5B57", "mojibake");
    System.out.printf("Replaced: %s\n", replaced);
  }//from  w  w  w.  jav a  2 s.  c  o  m
}

Related Tutorials