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
2 answers

Java StringTokenizer how to find the end of the paragraph?

I am study Java String Tokenizer. I am looking for the way to find end of the paragraph. For example, I have one text file.. HI I am bob the the bob And I am am bob bob bob lu the the hello I am reading txt file and I am using the String…
Dc Redwing
  • 1,681
  • 11
  • 32
  • 42
0
votes
2 answers

using regular expression as delimiter with StringTokenizer

I am new to java progrmming and came across the StringTokenizer class. The constructor accepts the string to be split and another optional delimiter string each character of which gets treated as an individual delimiter while splitting the original…
Victor Mukherjee
  • 10,487
  • 16
  • 54
  • 97
0
votes
2 answers

Need a better method of reading and storing values from text file

Goal: to get values from a text file and store it into values to load into my sqlite database. Problem: My method is not efficient, and I need help comming up with an easier way. As of right now I am parsing my textfile that looks like…
The Tokenizer
  • 1,564
  • 3
  • 29
  • 46
0
votes
1 answer

passing semicolon separated data to function

I wanted to modify the below procedure to send data in the form 1;2;3 .In the below procedure I am sending data like 1 then I check if the data is a valid number if yes then I get query to some table and get the data count. I am not able to modify…
0
votes
1 answer

stringTokenizer method error

I am trying to use stringTokenizer method for reading a 2D array stored in a file in the format.. 1 1 1 1 the code is... BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); for(int i=0;i
Pdksock
  • 1,042
  • 2
  • 13
  • 26
0
votes
3 answers

StringTokenizer not making tokens with new lines

I am having trouble making a StringTokenizer break up a few lines of text into separate tokens. The inputted text is 3 monkeys But, the StringTokenizer is apparently interpreting this as "3monkeys". I need it to be "3" and "monkeys". Because of…
kullalok
  • 813
  • 2
  • 13
  • 19
0
votes
2 answers

Ideas for Create a lexical analyzer program using java

I am trying to create a lexical analyzer program using java.Program must have the concept of tokenization .I have beginner level knowledge in compiler programming.I know there are lot of Lexical generators exist on internet.I can use them to test my…
0
votes
3 answers

Inversing a String

The program below should do this: When the user input: The quick brown fox. Jumps over. The lazy dog. It should output: God yzal eth. Revo spmuj. Xof nworb kciuq eht. But instead when the user input: The quick brown fox. Jumps over. The lazy…
user1531959
0
votes
3 answers

How to call split(token) on a string that does not contain the token without causing an error?

I have two types of strings as the IDs of elements in my HTML markup: Dates: "april-23" "march-20" and season names: "springtime" "winter" The dates have a dash separating the month and the day. The seasons are a single word with no other…
0
votes
2 answers

Need a method like Java's StringTokenizer hasTokens() method in Visual C#

I did some searching on here and couldn't find the answer I exactly needed. I have a struct that contains search parameters that I need to send to a Web Service, and one of the fields I am trying to fill is a List. The original code was written to…
darethas
  • 7,377
  • 3
  • 23
  • 32
0
votes
1 answer

Text to Speech Android

I am trying to create a Text to Speech app that will remember the last sentence or part of the sentence after a comma where it was when the app is paused. Below is my code. @Override public void onCreate(Bundle savedInstanceState) { …
ControlAltDelete
  • 3,576
  • 5
  • 32
  • 50
0
votes
2 answers

android replace delimeter with newline

I have a string which has delimiter in it. I want to know the best way to replace the delimiter with a new line. I have had various issues with using the String Tokenizer the main problem being NoSuchElementException. Basically my approach thus far…
al23dev
  • 845
  • 2
  • 8
  • 17
0
votes
2 answers

Add if statements to tokenize

I am trying to write a program that will take a text file with commands such as insert, delete and sort and have them insert or delete a node from a linked list. So far I have been able to tokenize the strings and write them out; but I also want to…
Lane Fujikado
  • 135
  • 1
  • 3
  • 11
0
votes
4 answers

Using full stop as string delimiter in Stringtokenizer

I would like to exclude full stop . from string tokens like in the following case: I go to school. Would like to generate tokens as: [ I] [go] [to] [school] I used stringTokenizer as: List listStr = new…
thetna
  • 6,903
  • 26
  • 79
  • 113
0
votes
3 answers

Java equivalent of C# `StringSplitOptions.RemoveEmptyEntries` and Java `StringTokenizer(input2, "{},() \t")`

Being a Java Newbie, I am struggling with String.split. Trying to tokenism the following string "(3,3,{S,W,P},{P,W,P},{P,P,P}),(1,2,{S,E}),(2,1,{{S},{E}})" with the regex pattern "\\{|\\(|\\}|\\)|\\s|," using String.split. Unfortunately, it also…
Abhijit
  • 62,056
  • 18
  • 131
  • 204