public class StringParser extends Object
Assumes that string contains list of parameters separated by given char. Any white character are removed during parsing.
Constructor and Description |
---|
StringParser() |
Modifier and Type | Method and Description |
---|---|
static int |
getNumofParam(String s,
char ch)
Get number of parameters in input string.
|
static String[] |
getParams(String s,
char ch)
Split input string into separate substrings using defined separator.
|
static String |
removeSpaces(String in)
Remove spaces from beginning and end of string.
|
public static int getNumofParam(String s, char ch)
Simply return number of given chars in input string. Does not check other conditions.
s
- string to be parsedch
- char to look forpublic static String[] getParams(String s, char ch)
All leading and trailing white characters are removed from output strings. Output array may contain empty fields if incorrect string is given
s
- string to be parsedch
- char to look forCopyright © 2002–2019 Department of Computer Science, Warwick University. All rights reserved.