Added Utils.parseBoolean() method to parse 0/1 booleans.
Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
@@ -691,4 +691,14 @@ public class Utils {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the integer string argument as a boolean:
|
||||
* {@code 1} is {@code true}, and all other values are {@code false}.
|
||||
* @param s the {@code String} containing the boolean representation to be parsed
|
||||
* @return the boolean represented by the string argument
|
||||
*/
|
||||
public static boolean parseBoolean(String s) {
|
||||
return (Integer.parseInt(s) == 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user