The StringTokenizer class allows an application to break a string into tokens by performing code point comparison. The StringTokenizer methods do not distinguish among identifiers, numbers, and quoted strings, nor do they recognize and skip comments. The set of delimiters (the co
| 102 | * </blockquote> |
| 103 | */ |
| 104 | public class StringTokenizer implements java.util.Enumeration<Object> { |
| 105 | |
| 106 | private String string; |
| 107 | |
| 108 | private String delimiters; |
| 109 | |
| 110 | private boolean returnDelimiters; |
| 111 | |
| 112 | private int position; |
| 113 | |
| 114 | /** |
| 115 | * Constructs a new {@code StringTokenizer} for the parameter string using |
| 116 | * whitespace as the delimiter. The {@code returnDelimiters} flag is set to |
| 117 | * {@code false}. |
| 118 | * |
| 119 | * @param string |
| 120 | * the string to be tokenized. |
| 121 | */ |
| 122 | public StringTokenizer(String string) { |
| 123 | this(string, " \t\n\r\f", false); //$NON-NLS-1$ |
| 124 | } |
| 125 | |
| 126 | /** |
| 127 | * Constructs a new {@code StringTokenizer} for the parameter string using |
| 128 | * the specified delimiters. The {@code returnDelimiters} flag is set to |
| 129 | * {@code false}. If {@code delimiters} is {@code null}, this constructor |
| 130 | * doesn't throw an {@code Exception}, but later calls to some methods might |
| 131 | * throw a {@code NullPointerException}. |
| 132 | * |
| 133 | * @param string |
| 134 | * the string to be tokenized. |
| 135 | * @param delimiters |
| 136 | * the delimiters to use. |
| 137 | */ |
| 138 | public StringTokenizer(String string, String delimiters) { |
| 139 | this(string, delimiters, false); |
| 140 | } |
| 141 | |
| 142 | /** |
| 143 | * Constructs a new {@code StringTokenizer} for the parameter string using |
| 144 | * the specified delimiters, returning the delimiters as tokens if the |
| 145 | * parameter {@code returnDelimiters} is {@code true}. If {@code delimiters} |
| 146 | * is null this constructor doesn't throw an {@code Exception}, but later |
| 147 | * calls to some methods might throw a {@code NullPointerException}. |
| 148 | * |
| 149 | * @param string |
| 150 | * the string to be tokenized. |
| 151 | * @param delimiters |
| 152 | * the delimiters to use. |
| 153 | * @param returnDelimiters |
| 154 | * {@code true} to return each delimiter as a token. |
| 155 | */ |
| 156 | public StringTokenizer(String string, String delimiters, |
| 157 | boolean returnDelimiters) { |
| 158 | if (string != null) { |
| 159 | this.string = string; |
| 160 | this.delimiters = delimiters; |
| 161 | this.returnDelimiters = returnDelimiters; |
nothing calls this directly
no outgoing calls
no test coverage detected