Home | History | Annotate | Download | only in util

Lines Matching defs:string

35      * Creates a comma-separated String from the given List of String objects.
37 public static String commaSeparatedString(List list, boolean quoteStrings)
53 String string = (String)list.get(index);
57 string = quotedString(string);
60 buffer.append(string);
68 * Creates a List of String objects from the given comma-separated String.
70 public static List commaSeparatedList(String string)
72 if (string == null)
79 while ((index = skipWhitespace(string, index)) < string.length())
84 if (string.charAt(index) == '\'')
86 // Parse a quoted string.
87 nextIndex = string.indexOf('\'', index + 1);
90 nextIndex = string.length();
93 list.add(string.substring(index + 1, nextIndex));
97 // Parse a non-quoted string.
98 nextIndex = string.indexOf(',', index);
101 nextIndex = string.length();
104 String substring = string.substring(index, nextIndex).trim();
121 private static int skipWhitespace(String string, int index)
123 while (index < string.length() &&
124 Character.isWhitespace(string.charAt(index)))
133 * Returns a quoted version of the given string, if necessary.
135 private static String quotedString(String string)
137 return string.length() == 0 ||
138 string.indexOf(' ') >= 0 ||
139 string.indexOf('@') >= 0 ||
140 string.indexOf('{') >= 0 ||
141 string.indexOf('}') >= 0 ||
142 string.indexOf('(') >= 0 ||
143 string.indexOf(')') >= 0 ||
144 string.indexOf(':') >= 0 ||
145 string.indexOf(';') >= 0 ||
146 string.indexOf(',') >= 0 ? ("'" + string + "'") :
147 ( string );
151 public static void main(String[] args)
155 System.out.println("Input string: ["+args[0]+"]");
175 String string = commaSeparatedString(list, true);
177 System.out.println("Resulting string: ["+string+"]");