Back to project page sdl_tester_android.
The source code is released under:
Copyright (c) 2014, Ford Motor Company All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are m...
If you think the Android project sdl_tester_android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.livio.sdl.utils; //from w ww. ja v a 2s . c om import java.util.Vector; /** * Contains static methods useful in dealing with String objects. * * @author Mike Burke * */ public final class StringUtils { private static final String DEFAULT_DELIMITER = ","; private StringUtils(){} /** * Determines if the input string is an integer or not. * * @param input String to analyze * @return True if the string is an integer, false if not */ public static boolean isInteger(String input){ try{ Integer.parseInt(input); return true; }catch(NumberFormatException e){ // if the string can't be parsed as an integer, it isn't a number. return false; } } /** * Splits up a CSV string into a vector of strings. * * @param input The CSV string to process * @return The created vector of strings */ public static Vector<String> toVector(String input){ return toVector(input, DEFAULT_DELIMITER); } /** * Splits up a string into a vector of strings based on the input delimiter. * * @param input The raw string to process * @param delim The delimiter on which to split the string * @return The created vector of strings */ public static Vector<String> toVector(String input, String delim){ if(input == null){ throw new NullPointerException(); } if(delim == null){ delim = DEFAULT_DELIMITER; } String[] inputArray = input.split(delim); Vector<String> result = new Vector<String>(inputArray.length); for(String splitStr : inputArray){ result.add(splitStr.trim()); } return result; } }