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

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,
 
G

Guest

Use the Split() method on the string object...

i.e. :

string[] strings = myString.Split(new char[] { ';' });
 
M

Mats Lycken

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top