MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / StringTokenizer

Class StringTokenizer

Ports/CLDC11/src/java/util/StringTokenizer.java:94–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92/// \udc00
93/// ```
94public class StringTokenizer implements java.util.Enumeration<Object> {
95
96 private String string;
97
98 private String delimiters;
99
100 private boolean returnDelimiters;
101
102 private int position;
103
104 /// Constructs a new `StringTokenizer` for the parameter string using
105 /// whitespace as the delimiter. The `returnDelimiters` flag is set to
106 /// `false`.
107 ///
108 /// #### Parameters
109 ///
110 /// - `string`: the string to be tokenized.
111 public StringTokenizer(String string) {
112 this(string, " \t\n\r\f", false); //$NON-NLS-1$
113 }
114
115 /// Constructs a new `StringTokenizer` for the parameter string using
116 /// the specified delimiters. The `returnDelimiters` flag is set to
117 /// `false`. If `delimiters` is `null`, this constructor
118 /// doesn't throw an `Exception`, but later calls to some methods might
119 /// throw a `NullPointerException`.
120 ///
121 /// #### Parameters
122 ///
123 /// - `string`: the string to be tokenized.
124 ///
125 /// - `delimiters`: the delimiters to use.
126 public StringTokenizer(String string, String delimiters) {
127 this(string, delimiters, false);
128 }
129
130 /// Constructs a new `StringTokenizer` for the parameter string using
131 /// the specified delimiters, returning the delimiters as tokens if the
132 /// parameter `returnDelimiters` is `true`. If `delimiters`
133 /// is null this constructor doesn't throw an `Exception`, but later
134 /// calls to some methods might throw a `NullPointerException`.
135 ///
136 /// #### Parameters
137 ///
138 /// - `string`: the string to be tokenized.
139 ///
140 /// - `delimiters`: the delimiters to use.
141 ///
142 /// - `returnDelimiters`: `true` to return each delimiter as a token.
143 public StringTokenizer(String string, String delimiters,
144 boolean returnDelimiters) {
145 if (string != null) {
146 this.string = string;
147 this.delimiters = delimiters;
148 this.returnDelimiters = returnDelimiters;
149 this.position = 0;
150 } else
151 throw new NullPointerException();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected