Java String to Boolean stringToBooleanArray(String string, String delim)

Here you can find the source of stringToBooleanArray(String string, String delim)

Description

string To Boolean Array

License

Open Source License

Declaration

public static boolean[] stringToBooleanArray(String string, String delim) 

Method Source Code


//package com.java2s;
/* /*from   www .j  a  v a  2  s  .com*/
 * RealmSpeak is the Java application for playing the board game Magic Realm.
 * Copyright (c) 2005-2015 Robin Warren
 * E-mail: robin@dewkid.com
 * 
 * This program is free software: you can redistribute it and/or modify it under the terms of the
 * GNU General Public License as published by the Free Software Foundation, either version 3 of the License,
 * or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
 * for more details.
 * 
 * You should have received a copy of the GNU General Public License along with this program. If not, see
 *
 * http://www.gnu.org/licenses/
 */

import java.util.*;

public class Main {
    public static boolean[] stringToBooleanArray(String string, String delim) {
        StringTokenizer tokens = new StringTokenizer(string, delim);
        boolean[] ret = new boolean[tokens.countTokens()];
        for (int i = 0; i < ret.length; i++) {
            ret[i] = tokens.nextToken().equals("T");
        }
        return ret;
    }
}

Related

  1. convertStringToBoolean(String pValue)
  2. convertStringToBoolean(String strBoolean)
  3. convertStringToBoolean(String string)
  4. convertStringToBoolean(String string)
  5. stringToBoolean(String expr)