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
-2
votes
1 answer

Scanner and StringTokenizer

I have a problem with this source when I use StringTokenizer and Scanner together. This is the source: package deberes.contador; import java.util.Scanner; import java.util.StringTokenizer; public class Contador { public static void…
Kemical
  • 7
  • 1
  • 5
-2
votes
2 answers

StringTokenizer and HashMap (logic required)

Scenario: You have been supplied with an ascii text file containing one day’s worth of catch records. Each line in the file contains one "colon separated" catch record with three fields: CONTESTANTS_NAME:FISH_TYPE:FISH_WEIGHT for…
ac3hole
  • 123
  • 2
  • 10
-2
votes
1 answer

How to tokenize string with alphabetical and numerical values

I have a string like "test123abc45alsdkfj", I want my scanner to behave such that it read "test" first, then 123, then "abc", then 45, then "alsdkfj". Kinda like stringstream in C++, is there a way to do this? Thanks!
-2
votes
1 answer

String tokenizing in VB.net

When I run this program the button for tokenize is not working I don't know why? Is there any changes? Private Sub Tokenize_Click() Dim tok As New Tokenizer Dim s As String tok.init txString.Text lsTokens.Clear…
-2
votes
1 answer

When using a string tokenizer , how do I check the next character after a token if it is a delimiter?

Say for example I have a string which is the following "3*x+(b[3]+c)+x" And my delimiters are " \t*+-/()[]" When I use the string tokenizer to split the string and I get to token "b", how can I check to make sure that the next delimiter is "[". I…
O. Syed
  • 1
  • 1
  • 3
-2
votes
2 answers

StringTokenizer says java.util.NoSuchElementException

When I run my code using BufferedReader class as well as util class and initialising the variables outside the StringTokenizer using BufferedReader class then it works but when I use this it breaks and I get java.util.NoSuchElementException error as…
-2
votes
2 answers

Converting object value to string array

so I have been trying to convert an object value to string array. basically I'm using stringtokenizer to get the strings from a text file, so I can search for specific values. I am using this library first time. so any help wold be appreciated. here…
Usman Malik
  • 11
  • 2
  • 7
-2
votes
1 answer

Reading Words for a String

I want to manipulate this string: "Roger:Rabbit:22:California" and display the output as follows: Name: Roger Rabbit Age: 22 State: California I am wondering what will be the best approached to this?
-2
votes
1 answer

build a scanner with stringtokenizer

I have a problem in this code, i'm trying to build a scanner for my project in compiler course, the scanner takes any input from the user and separate it into tokens .. the output will be : print each token and it's type(like:…
Mina Mikhail
  • 91
  • 1
  • 5
-2
votes
2 answers

Single Java StringTokenizer for multiple processing

I have a Java String such as "10 20 30 40 50". I want to process these values using StringTokenizer basing on some business requirements multiple times. For example, for certain condition, I want to double each of the values i.e., "20 40 60 80 100"…
RLD
  • 1,867
  • 3
  • 15
  • 20
-2
votes
2 answers

How to deal with this NullPointerException?

I was making a program where it would count how many times every word was used in a random paragraph. It compiles, but when i try to run it its giving me a NullPointerException. Here's the code: import java.util.StringTokenizer; class Count { …
Mohit Saxena
  • 89
  • 1
  • 12
-2
votes
1 answer

A Program With StringTokenizer in Java

I wrote a simple calculation program. I want users to enter their request as 12+12 and return the answer. I used StringTokenizer, but I got an error and it doesn't show me any result. There was a mention that Calc is a superclass and MinusCalc and…
MarAnd
  • 11
  • 6
-2
votes
1 answer

Why scanner classes in java are not in 'jav.io' package?

Why StringTokenizer and Scanner classes are not a part of java.io package but these belongs to java.util package?
-2
votes
3 answers

Arrangement of words in a sentence alphabetically

Suppose we're given a sentence. Then, how would we arrange the words alphabetically? For example, Sentence: Big Bang Theory is better than Two and a Half Men. Arranged Sentence: a and Bang better Big Half is Men than Theory Two. I was thinking of…
-2
votes
1 answer

How to access, edit or delete tokens in stringtokenizer in java

Its my first question on stackoverflow please cooperate How to read tokens one by one using a loop??? i have too many tokens in my stringtokenizer and i want to analyze them one by one using a loop(for or while any one) so please me help in…
Shubham
  • 72
  • 1
  • 10