Android Open Source - YahooWeather Ascii Utils






From Project

Back to project page YahooWeather.

License

The source code is released under:

GNU General Public License

If you think the Android project YahooWeather listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.imlongluo.weather.apis;
//  www  . j  av a2  s  . co m
class AsciiUtils {
    private static final String PLAIN_ASCII = "AaEeIiOoUu" // grave
            + "AaEeIiOoUuYy" // acute
            + "AaEeIiOoUuYy" // circumflex
            + "AaOoNn" // tilde
            + "AaEeIiOoUuYy" // umlaut
            + "Aa" // ring
            + "Cc" // cedilla
            + "OoUu" // double acute
    ;

    private static final String UNICODE = "\u00C0\u00E0\u00C8\u00E8\u00CC\u00EC\u00D2\u00F2\u00D9\u00F9"
            + "\u00C1\u00E1\u00C9\u00E9\u00CD\u00ED\u00D3\u00F3\u00DA\u00FA\u00DD\u00FD"
            + "\u00C2\u00E2\u00CA\u00EA\u00CE\u00EE\u00D4\u00F4\u00DB\u00FB\u0176\u0177"
            + "\u00C3\u00E3\u00D5\u00F5\u00D1\u00F1"
            + "\u00C4\u00E4\u00CB\u00EB\u00CF\u00EF\u00D6\u00F6\u00DC\u00FC\u0178\u00FF"
            + "\u00C5\u00E5" + "\u00C7\u00E7" + "\u0150\u0151\u0170\u0171";

    // private constructor, can't be instanciated!
    private AsciiUtils() {
    }

    // remove accentued from a string and replace with ascii equivalent
    public static String convertNonAscii(String s) {
        if (s == null)
            return null;
        StringBuilder sb = new StringBuilder();
        int n = s.length();
        for (int i = 0; i < n; i++) {
            char c = s.charAt(i);
            int pos = UNICODE.indexOf(c);
            if (pos > -1) {
                sb.append(PLAIN_ASCII.charAt(pos));
            } else {
                sb.append(c);
            }
        }
        return sb.toString();
    }
}




Java Source Code List

cn.sharesdk.demo.wxapi.WXEntryActivity.java
cn.sharesdk.onekeyshare.CustomerLogo.java
cn.sharesdk.onekeyshare.EditPage.java
cn.sharesdk.onekeyshare.FollowList.java
cn.sharesdk.onekeyshare.OnekeyShare.java
cn.sharesdk.onekeyshare.PicViewer.java
cn.sharesdk.onekeyshare.PlatformGridView.java
cn.sharesdk.onekeyshare.Shake2Share.java
cn.sharesdk.onekeyshare.ShareContentCustomizeCallback.java
cn.sharesdk.onekeyshare.ShareCore.java
com.imlongluo.weather.MainActivity.java
com.imlongluo.weather.WeatherApplication.java
com.imlongluo.weather.apis.AsciiUtils.java
com.imlongluo.weather.apis.ImageUtils.java
com.imlongluo.weather.apis.NetworkUtils.java
com.imlongluo.weather.apis.UserLocationUtils.java
com.imlongluo.weather.apis.WOEIDInfo.java
com.imlongluo.weather.apis.WOEIDUtils.java
com.imlongluo.weather.apis.WeatherInfo.java
com.imlongluo.weather.apis.YahooWeatherConsts.java
com.imlongluo.weather.apis.YahooWeatherExceptionListener.java
com.imlongluo.weather.apis.YahooWeatherInfoListener.java
com.imlongluo.weather.apis.YahooWeatherLog.java
com.imlongluo.weather.apis.YahooWeather.java
com.imlongluo.weather.lbs.LocationGetter.java
com.imlongluo.weather.lbs.LocationManagerActivity.java
com.imlongluo.weather.settings.SettingsActivity.java
com.imlongluo.weather.share.ShareActivity.java
com.imlongluo.weather.utils.Constants.java
com.imlongluo.weather.utils.Utils.java