Questions tagged [stringtokenizer]

StringTokenizer is a Java class that breaks a string into tokens.

This tag is used for questions about or involving the StringTokenizer class in Java, which is used to break a single string into multiple, individual "tokens".

StringTokenizer is an old class, called the "legacy class" in documentation, suggesting to use String.split instead. However as of 1.7, it is not deprecated. Another class with similar but more advanced functionality is .

Questions tagged should also be tagged .

Useful links:

627 questions
0
votes
4 answers

In PHP, how to achieve the same purpose like StringTokenizer in Java?

Say I have a String 030512 Jack 25 Male\n030513 David 23 Male\n030514 ..., how to extract the info from this String as a two dimensional table in PHP? In Java, I can use StringTokenizer, like: StringTokenizer lineTokenizer = new…
JackWM
  • 10,085
  • 22
  • 65
  • 92
0
votes
1 answer

Hidden char StringTokeneizer/split in Java?

I have a text file and each of its line is like that author-title-kind I have a Java program parsing this file and it must returns only the books whose author is "example". I read a line at a time, and then I split the string with StringTokeneizer…
SagittariusA
  • 5,289
  • 15
  • 73
  • 127
0
votes
2 answers

How do you negate regex within delimiter string in string tokenizer in Java

Suppose I wanted to tokenize a text where everything other than [a-zA-Z] are set as delimiters how do I write the sringtokenizer in Java? Would it look something like this: StringTokenizer st = new StringTokenizer(data, "[[^a-z]&&[^A-Z]");?
Chris Olszewski
  • 153
  • 2
  • 8
0
votes
2 answers

why StringTokenizer does not work properly for $$ as delimeter

I am using StringTokenizer to tokenize a string with $$ as delimeter but if my string is like $1$dga74 then it tokenize this from first $. Can any body tell me why this happens and what can I do to remove this issue. String…
agarwal_achhnera
  • 2,582
  • 9
  • 55
  • 84
0
votes
2 answers

Group by using a delimitor oracle

I have the data in the format data column1 column2 abcd ~123~abd~ The data in column 2 is separated by ~ the output should be in the format in two rows column1 column2 abcd 123 abcd abd can some please help.
Umesh
  • 3
  • 2
0
votes
0 answers

How can i use scanner and tokens?

i have already asked about how can i split the user's input using tokens but i want to split it using the scanner class in order to use each token separately ... example... suppose that we have this input : what time is it When i split it to…
0
votes
1 answer

String tokenizers in java - reinitializing

I have a program which searches for words in a given list(alphabetically arranged). Thing is say, I put in "abc" and "def" and then "abcd". It'll search for "abc" - print it, now the string tokenizer will continue searching for "def" from the token…
Karthik Balakrishnan
  • 4,353
  • 6
  • 37
  • 69
0
votes
3 answers

Reverse each sentence

Say my input is now is the time for all good men to come to the aid of the party The output would be: for time the is now party the of aid the to come to men good all I figured out how to reverse each the whole text file but I need…
Deniz Cetinalp
  • 901
  • 1
  • 18
  • 34
0
votes
3 answers

java: Splitting arithmetic expresssion into tokens

How do you separate an arithmetic expression with space, example i have this expression 22+(33*1) i want to split them with space between operators in the same string (returning a String) like 22 + ( 33 * 1 ) by the way im using StringTokenizer
lemoncodes
  • 2,371
  • 11
  • 40
  • 66
0
votes
2 answers

Reading CSV file without third-party libraries

I'm trying to read a csv file into either an ArrayList or a String [][] array. In this I'm trying to read it into a list and then form the list, using a tokenizer, into an array. The csv file have 7 columns (A - G) and 961 rows (1-961). My for loop…
Fred V
  • 187
  • 1
  • 11
0
votes
2 answers

Java StringTokenizer and storing Array

I have programmed a Worker class and the driverclass for Worker.. My working class is compiling fine and showing the desired output.. But in array and StringTokenizer I am facing the main problem... And in line 32 of TestWorker.java there is an…
bleach64
  • 107
  • 1
  • 6
  • 14
0
votes
1 answer

What is the equivalent of this tokenizer code in C#?

This is a java code for android. I'm trying to convert this to windows c#. I tried using split but I don't know how to go to the next element. StringTokenizer st = new StringTokenizer(source, "><"); String marker =…
pmark019
  • 1,199
  • 5
  • 15
  • 24
0
votes
1 answer

StringTokenizer and Array Java

I am completed the whole program, and it is working fine. But, I am having trouble with the StringTokenizer. I have class named Worker.java and a test class named TestWorker.java... In the test class I have calculated and printed out the total…
bleach64
  • 107
  • 1
  • 6
  • 14
0
votes
1 answer

Using Tokenizer with ArrayLists in Java

I am trying to take an ArrayList of strings and separate it so that i can extract a title from each line. Here is the contents of the ArrayList: Tom Sawyer;Twain, Mark;1972;8.50;f; Leaves of Grass;Whitman, Walt;1975;29.99;p; Romeo and…
TheNameHobbs
  • 679
  • 7
  • 21
  • 36
0
votes
3 answers

How to make select query with StringTokenizer?

I'm trying to make a query with selected fields for final user from view (JSP) to controller, but I don't know how. For example, I have this parameters from view (JSP) IDUSER,>,2,OR,USERNAME,=,'KURT' So, I'll want to have something like…
hekomobile
  • 1,388
  • 1
  • 14
  • 35