Java String to SBC toSBC(String s)

Here you can find the source of toSBC(String s)

Description

to SBC

License

Apache License

Declaration

public static String toSBC(String s) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {

    public static String toSBC(String s) {
        if (isEmpty(s))
            return s;
        char[] chars = s.toCharArray();
        for (int i = 0, len = chars.length; i < len; i++) {
            if (chars[i] == ' ') {
                chars[i] = (char) 12288;
            } else if (33 <= chars[i] && chars[i] <= 126) {
                chars[i] = (char) (chars[i] + 65248);
            } else {
                chars[i] = chars[i];//from w  ww  . j av  a  2s  .  co m
            }
        }
        return new String(chars);
    }

    public static boolean isEmpty(CharSequence s) {
        return s == null || s.length() == 0;
    }

    public static int length(CharSequence s) {
        return s == null ? 0 : s.length();
    }
}

Related

  1. toSBC(String input)
  2. ToSBC(String input)