本文整理汇总了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;
}
示例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;
}
}
}
示例3: iterator
import android.text.TextUtils.SimpleStringSplitter; //导入依赖的package包/类
@Override
public Iterator<String> iterator() {
SimpleStringSplitter splitter = new SimpleStringSplitter(',');
splitter.setString(value);
return splitter.iterator();
}
示例4: iterator
import android.text.TextUtils.SimpleStringSplitter; //导入依赖的package包/类
@Override
public Iterator<String> iterator() {
SimpleStringSplitter splitter = new SimpleStringSplitter(',');
splitter.setString(value);
return splitter.iterator();
}