Java's StringTokenizer is *what* in .NET?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there,

What would be the counterpart for Java's StringTokenizer class in .NET?

In fact, does anybody know a good web site that gives this kind of
information, like a Java-.NET/.NET-Java dictionary or equivalency table?

Many thanks,
 
Use the Split() method on the string object...

i.e. :

string[] strings = myString.Split(new char[] { ';' });
 
from http://java.sun.com/j2se/1.4.2/docs/api/java/util/StringTokenizer.html:

StringTokenizer is a legacy class that is retained for compatibility reasons
although its use is discouraged in new code. It is recommended that anyone
seeking this functionality use the split method of String or the
java.util.regex package instead.
The following example illustrates how the String.split method can be used to
break up a string into its basic tokens:

String[] result = "this is a test".split("\\s");
for (int x=0; x<result.length; x++)
System.out.println(result[x]);
prints the following output:

this
is
a
test
^ the .net version of that is pretty much identical to java
 
Back
Top