本文整理汇总了Java中android.text.TextUtils.split方法的典型用法代码示例。如果您正苦于以下问题:Java TextUtils.split方法的具体用法?Java TextUtils.split怎么用?Java TextUtils.split使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.text.TextUtils
的用法示例。
在下文中一共展示了TextUtils.split方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parsePackageList
import android.text.TextUtils; //导入方法依赖的package包/类
private boolean parsePackageList() {
final String baseString = CMSettings.System.getString(getContentResolver(),
CMSettings.System.NOTIFICATION_LIGHT_PULSE_CUSTOM_VALUES);
if (TextUtils.equals(mPackageList, baseString)) {
return false;
}
mPackageList = baseString;
mPackages.clear();
if (baseString != null) {
final String[] array = TextUtils.split(baseString, "\\|");
for (String item : array) {
if (TextUtils.isEmpty(item)) {
continue;
}
Package pkg = Package.fromString(item);
if (pkg != null) {
mPackages.put(pkg.name, pkg);
}
}
}
return true;
}
示例2: PersistentCookieStore
import android.text.TextUtils; //导入方法依赖的package包/类
/**
* Construct a persistent cookie store.
*
* @param context Context to attach cookie store to
*/
public PersistentCookieStore(Context context) {
cookiePrefs = context.getSharedPreferences(COOKIE_PREFS, 0);
cookies = new ConcurrentHashMap<String, Cookie>();
// Load any previously stored cookies into the store
String storedCookieNames = cookiePrefs.getString(COOKIE_NAME_STORE, null);
if (storedCookieNames != null) {
String[] cookieNames = TextUtils.split(storedCookieNames, ",");
for (String name : cookieNames) {
String encodedCookie = cookiePrefs.getString(COOKIE_NAME_PREFIX + name, null);
if (encodedCookie != null) {
Cookie decodedCookie = decodeCookie(encodedCookie);
if (decodedCookie != null) {
cookies.put(name, decodedCookie);
}
}
}
// Clear out expired cookies
clearExpired(new Date());
}
}
示例3: PersistentCookieStore
import android.text.TextUtils; //导入方法依赖的package包/类
/**
* Construct a persistent cookie store.
*
* @param context Context to attach cookie store to
*/
public PersistentCookieStore(Context context) {
cookiePrefs = context.getSharedPreferences(COOKIE_PREFS, 0);
cookies = new HashMap<String, ConcurrentHashMap<String, Cookie>>();
// Load any previously stored cookies into the store
Map<String, ?> prefsMap = cookiePrefs.getAll();
for (Map.Entry<String, ?> entry : prefsMap.entrySet()) {
if (entry.getValue() != null && !((String) entry.getValue()).startsWith(COOKIE_NAME_PREFIX)) {
String[] cookieNames = TextUtils.split((String) entry.getValue(), ",");
for (String name : cookieNames) {
String encodedCookie = cookiePrefs.getString(COOKIE_NAME_PREFIX + name, null);
if (encodedCookie != null) {
Cookie decodedCookie = decodeCookie(encodedCookie);
if (decodedCookie != null) {
if (!cookies.containsKey(entry.getKey()))
cookies.put(entry.getKey(), new ConcurrentHashMap<String, Cookie>());
cookies.get(entry.getKey()).put(name, decodedCookie);
}
}
}
}
}
}
示例4: capitalizeFully
import android.text.TextUtils; //导入方法依赖的package包/类
public static String capitalizeFully(String str) {
if (str == null || str.length() == 0) {
return str;
}
String [] s = TextUtils.split(str, " ");
if (s.length == 0) {
return capitalize(str);
}
else {
StringBuilder stringBuilder = new StringBuilder();
for (String ss:s){
stringBuilder.append(capitalize(ss));
stringBuilder.append(" ");
}
return stringBuilder.toString();
}
}
示例5: PersistentCookieStore
import android.text.TextUtils; //导入方法依赖的package包/类
public PersistentCookieStore(Context context) {
int i = 0;
this.cookiePrefs = context.getSharedPreferences(COOKIE_PREFS, 0);
String storedCookieNames = this.cookiePrefs.getString(COOKIE_NAME_STORE, null);
if (storedCookieNames != null) {
String[] cookieNames = TextUtils.split(storedCookieNames, ",");
int length = cookieNames.length;
while (i < length) {
String name = cookieNames[i];
String encodedCookie = this.cookiePrefs.getString(new StringBuilder(COOKIE_NAME_PREFIX).append(name).toString(), null);
if (encodedCookie != null) {
Cookie decodedCookie = decodeCookie(encodedCookie);
if (decodedCookie != null) {
this.cookies.put(name, decodedCookie);
}
}
i++;
}
clearExpired(new Date());
}
}
示例6: CookiesStore
import android.text.TextUtils; //导入方法依赖的package包/类
public CookiesStore(Context context) {
cookiePrefs = context.getSharedPreferences(JConfig.COOKIE_PREFS, 0);
cookies = new HashMap<>();
Map<String, ?> prefsMap = cookiePrefs.getAll();
for (Map.Entry<String, ?> entry : prefsMap.entrySet()) {
String[] cookieNames = TextUtils.split((String) entry.getValue(), ",");
for (String name : cookieNames) {
String encodedCookie = cookiePrefs.getString(name, null);
if (encodedCookie != null) {
Cookie decodedCookie = decodeCookie(encodedCookie);
if (decodedCookie != null) {
if (!cookies.containsKey(entry.getKey())) {
cookies.put(entry.getKey(), new ConcurrentHashMap<String, Cookie>());
}
cookies.get(entry.getKey()).put(name, decodedCookie);
}
}
}
}
}
示例7: MyCookieStore
import android.text.TextUtils; //导入方法依赖的package包/类
public MyCookieStore() {
cookiePrefs = ToolCache.getContext().getSharedPreferences(COOKIE_PREFS, Context.MODE_PRIVATE);
cookies = new HashMap<>();
//将持久化的cookies缓存到内存中,数据结构为 Map<Url.host, Map<Cookie.name, Cookie>>
Map<String, ?> prefsMap = cookiePrefs.getAll();
for (Map.Entry<String, ?> entry : prefsMap.entrySet()) {
if ((entry.getValue()) != null && !entry.getKey().startsWith(COOKIE_NAME_PREFIX)) {
//获取url对应的所有cookie的key,用","分割
String[] cookieNames = TextUtils.split((String) entry.getValue(), ",");
for (String name : cookieNames) {
//根据对应cookie的Key,从xml中获取cookie的真实值
String encodedCookie = cookiePrefs.getString(COOKIE_NAME_PREFIX + name, null);
if (encodedCookie != null) {
Cookie decodedCookie = decodeCookie(encodedCookie);
if (decodedCookie != null) {
if (!cookies.containsKey(entry.getKey()))
cookies.put(entry.getKey(), new ConcurrentHashMap<String, Cookie>());
cookies.get(entry.getKey()).put(name, decodedCookie);
}
}
}
}
}
}
示例8: PersistentCookieStore
import android.text.TextUtils; //导入方法依赖的package包/类
/**
* Construct a persistent cookie store.
*
* @param context Context to attach cookie store to
*/
public PersistentCookieStore(Context context)
{
cookiePrefs = context.getSharedPreferences(COOKIE_PREFS, 0);
cookies = new HashMap<String, ConcurrentHashMap<String, Cookie>>();
// Load any previously stored cookies into the store
Map<String, ?> prefsMap = cookiePrefs.getAll();
for (Map.Entry<String, ?> entry : prefsMap.entrySet())
{
if (((String) entry.getValue()) != null && !((String) entry.getValue()).startsWith(COOKIE_NAME_PREFIX))
{
String[] cookieNames = TextUtils.split((String) entry.getValue(), ",");
for (String name : cookieNames)
{
String encodedCookie = cookiePrefs.getString(COOKIE_NAME_PREFIX + name, null);
if (encodedCookie != null)
{
Cookie decodedCookie = decodeCookie(encodedCookie);
if (decodedCookie != null)
{
if (!cookies.containsKey(entry.getKey()))
cookies.put(entry.getKey(), new ConcurrentHashMap<String, Cookie>());
cookies.get(entry.getKey()).put(name, decodedCookie);
}
}
}
}
}
}
示例9: getSelectedLocale
import android.text.TextUtils; //导入方法依赖的package包/类
private static Locale getSelectedLocale(Context context) {
String language[] = TextUtils.split(TextSecurePreferences.getLanguage(context), "_");
if (language[0].equals(DEFAULT)) {
return new Locale("in");
} else if (language.length == 2) {
return new Locale(language[0], language[1]);
} else {
return new Locale(language[0]);
}
}
示例10: retrievePattern
import android.text.TextUtils; //导入方法依赖的package包/类
private List<Long> retrievePattern() {
String[] list = TextUtils.split(sharedPreferences.getString(DURATIONS, null), ",");
ArrayList<String> arrayListString = new ArrayList<>(Arrays.asList(list));
ArrayList<Long> arrayListLong = new ArrayList<>();
for (String str : arrayListString) {
arrayListLong.add(Long.parseLong(str));
}
Timber.v("retrieved list of durations:%s", arrayListLong.toString());
return arrayListLong;
}
示例11: parse
import android.text.TextUtils; //导入方法依赖的package包/类
/**
* Parses response string into ResponseData.
*
* @param responseData response data string
* @throws IllegalArgumentException upon parsing error
* @return ResponseData object
*/
public static ResponseData parse(String responseData) {
// Must parse out main response data and response-specific data.
int index = responseData.indexOf(':');
String mainData, extraData;
if ( -1 == index ) {
mainData = responseData;
extraData = "";
} else {
mainData = responseData.substring(0, index);
extraData = index >= responseData.length() ? "" : responseData.substring(index+1);
}
String [] fields = TextUtils.split(mainData, Pattern.quote("|"));
if (fields.length < 6) {
throw new IllegalArgumentException("Wrong number of fields.");
}
ResponseData data = new ResponseData();
data.extra = extraData;
data.responseCode = Integer.parseInt(fields[0]);
data.nonce = Integer.parseInt(fields[1]);
data.packageName = fields[2];
data.versionCode = fields[3];
// Application-specific user identifier.
data.userId = fields[4];
data.timestamp = Long.parseLong(fields[5]);
return data;
}
示例12: readSelectionFromBundle
import android.text.TextUtils; //导入方法依赖的package包/类
@Override
void readSelectionFromBundle(Bundle inBundle, String key) {
if (inBundle != null) {
String ids = inBundle.getString(key);
if (ids != null) {
String[] splitIds = TextUtils.split(ids, ",");
selectedIds.clear();
Collections.addAll(selectedIds, splitIds);
}
}
}
示例13: applyInAppPreferences
import android.text.TextUtils; //导入方法依赖的package包/类
public static void applyInAppPreferences() {
AppState app = AppState.getInstance();
app.changeShouldSpeakLapTimes(app.preferences.getBoolean(SPEAK_LAP_TIMES, true));
app.changeShouldSpeakMessages(app.preferences.getBoolean(SPEAK_MESSAGES, true));
app.changeShouldSpeakEnglishOnly(app.preferences.getBoolean(SPEAK_ENGLISH_ONLY, false));
app.changeTimeToPrepareForRace(app.preferences.getInt(PREPARATION_TIME, 5));
app.changeRaceLaps(app.preferences.getInt(LAPS_TO_GO, 5));
app.changeAdjustmentConst(app.preferences.getInt(LIPO_ADJUSTMENT_CONST, 0));
app.changeEnableLiPoMonitor(app.preferences.getBoolean(LIPO_MONITOR_ENABLED, true));
if (app.deviceStates != null) {
String pilots = app.preferences.getString(DEVICE_PILOTS, "");
if (!pilots.equals("")) {
String[] pilotsArray = TextUtils.split(pilots, STRING_ITEMS_DELIMITER);
int pilotsCount = pilotsArray.length;
for(int i = 0; i < app.deviceStates.size(); i++) {
if (i < pilotsCount) {
app.changeDevicePilot(i, pilotsArray[i]);
}
}
app.updatePilotNamesInEdits(); //because pilot names in UI are not updated via changeDevicePilot()
}
}
if (app.deviceStates != null) {
String statuses = app.preferences.getString(DEVICE_ENABLED, "");
if (!statuses.equals("")) {
String[] statusesArray = TextUtils.split(statuses, STRING_ITEMS_DELIMITER);
int statusesCount = statusesArray.length;
for(int i = 0; i < app.deviceStates.size(); i++) {
if (i < statusesCount) {
app.changeDeviceEnabled(i, Boolean.parseBoolean(statusesArray[i]));
}
}
}
}
}
示例14: getServiceAndLang
import android.text.TextUtils; //导入方法依赖的package包/类
public static String[] getServiceAndLang(String str) {
return TextUtils.split(str, SEPARATOR);
}
开发者ID:vaibhavs4424,项目名称:AI-Powered-Intelligent-Banking-Platform,代码行数:4,代码来源:RecognitionServiceManager.java
示例15: getVideoCodecList
import android.text.TextUtils; //导入方法依赖的package包/类
/**
* Get list of video codecs registered in preference system by
*
* @return List of possible video codecs
* @see PreferencesProviderWrapper#setVideoCodecList(java.util.List)
*/
public String[] getVideoCodecList() {
return TextUtils.split(prefs.getString(CODECS_VIDEO_LIST, ""), Pattern.quote(CODECS_SEPARATOR) );
}