All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.haoxuer.discover.plug.data.plugs.file.define.Encoder Maven / Gradle / Ivy

There is a newer version: 3.3.18-20230117
Show newest version
package com.haoxuer.discover.plug.data.plugs.file.define;

public class Encoder {
  
  public static String toUnicode(String input) {
    
    StringBuilder builder = new StringBuilder();
    char[] chars = input.toCharArray();
    
    for (char ch : chars) {
      
      if (ch < 256) {
        builder.append(ch);
      } else {
        builder.append("\\u" + Integer.toHexString(ch & 0xffff));
      }
      
    }
    
    return builder.toString();
    
  }
  
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy