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


Java TextUtils.split方法代码示例

本文整理汇总了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;
}
 
开发者ID:ric96,项目名称:lineagex86,代码行数:27,代码来源:NotificationLightSettings.java

示例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());
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:28,代码来源:PersistentCookieStore.java

示例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);
                    }
                }
            }
        }
    }
}
 
开发者ID:stytooldex,项目名称:stynico,代码行数:29,代码来源:PersistentCookieStore.java

示例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();
    }
}
 
开发者ID:dmllr,项目名称:IdealMedia,代码行数:18,代码来源:StringUtils.java

示例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());
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:22,代码来源:PersistentCookieStore.java

示例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);
                }
            }
        }
    }
}
 
开发者ID:jeasinlee,项目名称:AndroidBasicLibs,代码行数:21,代码来源:CookiesStore.java

示例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);
                    }
                }
            }
        }
    }
}
 
开发者ID:StickyTolt,项目名称:ForeverLibrary,代码行数:26,代码来源:MyCookieStore.java

示例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);
                    }
                }
            }

        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:36,代码来源:PersistentCookieStore.java

示例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]);
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:12,代码来源:DynamicLanguage.java

示例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;

}
 
开发者ID:egineering-llc,项目名称:secretknock,代码行数:15,代码来源:MainActivity.java

示例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;
}
 
开发者ID:tranleduy2000,项目名称:text_converter,代码行数:37,代码来源:ResponseData.java

示例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);
        }
    }
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:12,代码来源:PickerFragment.java

示例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]));
                }
            }
        }
    }
}
 
开发者ID:voroshkov,项目名称:Chorus-RF-Laptimer,代码行数:39,代码来源:AppPreferences.java

示例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) );
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:10,代码来源:PreferencesWrapper.java


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