当前位置: 首页>>代码示例>>Java>>正文


Java SimpleStringSplitter类代码示例

本文整理汇总了Java中android.text.TextUtils.SimpleStringSplitter的典型用法代码示例。如果您正苦于以下问题:Java SimpleStringSplitter类的具体用法?Java SimpleStringSplitter怎么用?Java SimpleStringSplitter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SimpleStringSplitter类属于android.text.TextUtils包,在下文中一共展示了SimpleStringSplitter类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isEnableAutoInstall

import android.text.TextUtils.SimpleStringSplitter; //导入依赖的package包/类
public static boolean isEnableAutoInstall() {
	Context mContext = AutoInstallerContext.getContext();
	SimpleStringSplitter simpleStringSplitter = new SimpleStringSplitter(':');
	if (!SettingsUtil.isAccessibiltiyEnable(mContext)) {
		return false;
	}
	String string = Secure.getString(mContext.getContentResolver(), "enabled_accessibility_services");
	if (string == null) {
		return false;
	}
	simpleStringSplitter.setString(string);
	while (simpleStringSplitter.hasNext()) {
		if (simpleStringSplitter.next().equalsIgnoreCase(
				AutoInstallerContext.getTargetService())) {
			return true;
		}
	}
	return false;
}
 
开发者ID:bunnyblue,项目名称:ApkAutoInstaller,代码行数:20,代码来源:InstallerUtils.java

示例2: loadStopLocations

import android.text.TextUtils.SimpleStringSplitter; //导入依赖的package包/类
void loadStopLocations(String routeNum, HashMap<Integer, LTCStop> stops) throws ScrapeException, IOException {
    StringBuilder builder = new StringBuilder(8192);
    String line;
    URL url;
    HttpURLConnection connection;
    boolean try_proxy = PROXY_ENABLED;
    while (true) {
        try {
            if (try_proxy) {
                url = new URL(String.format(PROXY_BASE + LOCATIONS_PATH, routeNum));
                connection = (HttpURLConnection) url.openConnection();
            } else {
                url = new URL(String.format(LTC_BASE + LOCATIONS_PATH, routeNum));
                connection = (HttpURLConnection) url.openConnection();
            }
            connection.setConnectTimeout(MAXIMUM_FETCH_TIMEOUT);
            connection.setReadTimeout(MAXIMUM_FETCH_TIMEOUT);
            BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
            while ((line = reader.readLine()) != null) {
                builder.append(line);
            }
            int offset = 0;
            String stopData = builder.toString();
            // skip past the crap at the start by finding the 1st asterisk
            for (int i = 0; i < 1; ++i) {
                offset = stopData.indexOf('*', offset) + 1;
            }
            /* get the interesting part, and while we're at it, remove all asterisks
     * so we don't have to deal with them at the start of latitudes later
     */
            String actualStopText = stopData.substring(offset).replace("*", "");
            StringSplitter splitter = new SimpleStringSplitter(';');
            splitter.setString(actualStopText);
            for (String stopInfo : splitter) {
                String elems[] = stopInfo.split("\\|");
                if (elems.length == 7) {
                    double latitude = Double.valueOf(elems[0]);
                    double longitude = Double.valueOf(elems[1]);
                    Matcher stopNumMatch = LOCATION_STOP_PATTERN.matcher(elems[4]);
                    if (stopNumMatch.find()) {
                        int stopNum = Integer.valueOf(stopNumMatch.group(1));
                        LTCStop stop = stops.get(stopNum);
                        if (stop != null) {
                            stop.latitude = latitude;
                            stop.longitude = longitude;
                        }
                    }
                }
            }
            connection.disconnect();
            return;
        } catch (SocketException e) {
            if (try_proxy) {
                try_proxy = false;
                continue;
            }
            // if this is already not the proxy, give up
            throw e;
        }
    }
}
 
开发者ID:LTBuses,项目名称:LTB-android,代码行数:62,代码来源:LTCScraper.java

示例3: iterator

import android.text.TextUtils.SimpleStringSplitter; //导入依赖的package包/类
@Override
public Iterator<String> iterator() {
          SimpleStringSplitter splitter = new SimpleStringSplitter(',');
          splitter.setString(value);
          return splitter.iterator();
      }
 
开发者ID:devscitech1,项目名称:aakash-fdroid-client,代码行数:7,代码来源:DB.java

示例4: iterator

import android.text.TextUtils.SimpleStringSplitter; //导入依赖的package包/类
@Override
public Iterator<String> iterator() {
	SimpleStringSplitter splitter = new SimpleStringSplitter(',');
	splitter.setString(value);
	return splitter.iterator();
}
 
开发者ID:keensam04,项目名称:aakash_bazaar_client,代码行数:7,代码来源:DB.java


注:本文中的android.text.TextUtils.SimpleStringSplitter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。