Android Open Source - Weather Weater Info Parser






From Project

Back to project page Weather.

License

The source code is released under:

GNU General Public License

If you think the Android project Weather 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.utils;
//from   w w w.j  av  a 2s  .  co m
import java.util.StringTokenizer;

/**
 * 
 * @author longluo 
 * ?????????????????????
 * 
 */
public class WeaterInfoParser {
  
  /**
   * ?????content????????????????????????????
   * ????????????: <code>????|?????,????|?????,.....</code>
   * @param content ??????????
   * @return ???????????????????
   */
  public static String[][] parseCity(String content) {
    //??content????
    if(content!=null&&content.trim().length()!=0) {
      StringTokenizer st=new StringTokenizer(content, ",");
      int count = st.countTokens();
      String[][] citys = new String[count][2];
      int i=0, index=0;
      while(st.hasMoreTokens()) {
        String city = st.nextToken();
        index = city.indexOf('|');
        citys[i][0] = city.substring(0, index);
        citys[i][1] = city.substring(index+1);
        i = i+1;
      }
      return citys;
    }
    return null;
  }
}




Java Source Code List

.WebAccessTools.java
com.imlongluo.weather.app.MainActivity.java
com.imlongluo.weather.app.SetCityActivity.java
com.imlongluo.weather.app.UpdateWidgetService.java
com.imlongluo.weather.app.WeatherWidget.java
com.imlongluo.weather.db.DBHelper.java
com.imlongluo.weather.location.GPSListAdapter.java
com.imlongluo.weather.location.MyListAdapter.java
com.imlongluo.weather.utils.LocationXMLParser.java
com.imlongluo.weather.utils.WeaterInfoParser.java