Example usage for java.lang String split

List of usage examples for java.lang String split

Introduction

In this page you can find the example usage for java.lang String split.

Prototype

public String[] split(String regex) 

Source Link

Document

Splits this string around matches of the given regular expression.

Usage

From source file:Main.java

public static Map<String, String> getQueryMap(String query) {
    String[] params = query.split("&");
    Map<String, String> map = new HashMap<String, String>();
    for (String param : params) {
        String[] splitted = param.split("=");
        map.put(splitted[0], splitted[1]);
    }//from www .  j a  v  a  2s.c o  m
    return map;
}

From source file:Main.java

public static String getBitbucketShareUrl(String repoIdentifier) {
    String[] arr = repoIdentifier.split("/");
    Uri.Builder uriBuilder = new Uri.Builder();
    uriBuilder.scheme("https").authority(BITBUCKET_BASE).appendPath(arr[0]).appendPath(arr[1]);
    return uriBuilder.build().toString();
}

From source file:Main.java

public static String getGithubShareUrl(String repoIdentifier) {
    String[] arr = repoIdentifier.split("/");
    Uri.Builder uriBuilder = new Uri.Builder();
    uriBuilder.scheme("https").authority(GITHUB_BASE).appendPath(arr[0]).appendPath(arr[1]);
    return uriBuilder.build().toString();
}

From source file:Main.java

/**
 * BE A9/* w  w  w  . j  a  va2  s  .c om*/
 * @param str
 */
public static byte stringToByte(String str) {
    String[] splitString = str.split("");
    int parseInt = Integer.parseInt(splitString[1], 16);
    int parseInt2 = Integer.parseInt(splitString[2], 16);
    int i = parseInt * 16 + parseInt2;
    return (byte) i;
}

From source file:Main.java

public static boolean[][] stringToBoolArray(String str) {
    String[] strArray = str.split(",");
    int size = strArray.length;
    boolean[][] result = new boolean[size][size];

    for (int i = 0; i < size; i++)
        for (int j = 0; j < size; j++)
            result[i][j] = strArray[i].charAt(j) == '1';

    return result;
}

From source file:Main.java

public static Map stringToMap(String msg) {
    String[] parameters = msg.split(",");
    Map<String, String> parameterMap = new HashMap<>();
    for (String parameter : parameters) {
        String[] para = parameter.split("=");
        parameterMap.put(para[0], para[1]);
    }/*from   www.ja va  2 s.  c om*/
    return parameterMap;
}

From source file:Main.java

private static int getPossiblyTagCount(String Line) {
    String strCount1[] = Line.split("\\[");
    String strCount2[] = Line.split("\\]");
    if (strCount1.length == 0 && strCount2.length == 0)
        return 1;
    else if (strCount1.length > strCount2.length)
        return strCount1.length;
    else/*from   w  ww. j a  v a  2  s  .c o m*/
        return strCount2.length;
}

From source file:Main.java

public static String getQueryDateFormat(String datestr) {

    String[] substrings = datestr.split("/");

    return String.valueOf(new StringBuilder().append(substrings[2]).append("-").append(substrings[0])
            .append("-").append(substrings[1]));

}

From source file:Main.java

@SuppressLint("DefaultLocale")
private static String getViewName(String idName) {
    String[] strings = idName.split("_");
    String viewName = strings[0];
    for (int i = 1; i < strings.length; i++) {
        viewName = viewName + strings[i].substring(0, 1).toUpperCase() + strings[i].substring(1);
    }//from w w  w.  j  ava 2s .co  m
    return viewName;
}

From source file:Main.java

private static String[] responseParse(String url) {
    return url.split("[=#&]");
}