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 String getTimeLapse(String time) {

    return String.valueOf((Integer.valueOf(time.split(":")[0]).intValue() + 10) % 24);

}

From source file:Main.java

/**
 * Get the mac address bytes format by the device's bssid String format
 * @param bssid the device's bssid String format
 * @return the mac address bytes format/*  w ww  .  j  a va 2 s  .co  m*/
 */
public static byte[] getMacAddressBytes(String bssid) {
    String[] bssidStrSplit = bssid.split(":");
    byte[] bssidBytes = new byte[bssidStrSplit.length];
    for (int i = 0; i < bssidStrSplit.length; ++i) {
        String bssidStr = bssidStrSplit[i];
        bssidBytes[i] = (byte) Integer.parseInt(bssidStr, 16);
    }
    return bssidBytes;
}

From source file:Main.java

/** Collapse consecutive duplicated tokens */
public static String collapse(String x) {
    return collapse(x.split(" "));
}