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

StringTokenizer only taking last word of the line

HI i am trying to tokenise a text file using StringTokeniser in java. But the problem is it only takes the last word of the line. Little help is needed. This sample code is part of a map-reduce function. String profile; StringTokenizer inputKey=new…
Rohit Haritash
  • 404
  • 5
  • 20
0
votes
1 answer

finding matches for part words in SOLR

I have a field with value of "holmes@sible.com" I want get back this field If I search for "sible". I use ngrams filter, which would help only if the string was "sible@holmes.com" Which filters/tokenizers should I use for such a thing (pretty much…
Itay Moav -Malimovka
  • 52,579
  • 61
  • 190
  • 278
-1
votes
5 answers

Adding tokens from .csv file to ArrayList in Java

I've been having trouble creating an ArrayList in Java from tokens that I get from a .csv file. I've been trying to figure it out for hours with no success. Without creating an ArrayList, all my tokens print out without a problem, but when I…
spacetree
  • 1
  • 1
  • 1
-1
votes
1 answer

Is it possible to replace the following code by lambda:

static TreeMap parseElementsBeforeOpenBracket(String inValue) { StringTokenizer tokenizer = new StringTokenizer(inValue, "[]", true); TreeMap mapElements = new TreeMap<>(); int i = 0; while…
aozhinsky
  • 1
  • 2
-1
votes
1 answer

How to use both a new line and comma as a delimeter for the StringTokenizer

I want to be able to use both the comma and a new line as a delimeter for tokens. This would be for just commas:Tokens = new StringTokenizer(line,","); but how would I implement it to account for a new line as well? I tried ",\n"and \n," but they do…
-1
votes
2 answers

StringTokeniser not reading data

I've to read data from a file and I've just entered some sample data as a String in StringTokenizer. I can't understand what is wrong with my code here. Can someone please advise? import java.util.StringTokenizer; public class rough { public…
wakanada
  • 115
  • 1
  • 9
-1
votes
1 answer

getting data from arraylist and parse it
I craet arraylist for storing values 2. ArrayList custInfo = new ArrayList(); while(rs.next()){ String loginId = rs.getString("LOGIN_ID"); String customerId =…
-1
votes
1 answer

Char count of each token in Tokenized String, Java

I'm trying to figure out if I can count the characters of each token and display that information such as: day is tokenized and my output would be: "Day has 3 characters." and continue to do that for each token. My last loop to print out the # of…
Zachary Mull
  • 63
  • 1
  • 7
-1
votes
2 answers

How to separate string using by commas in multicomma line

What should I do to for separate (test(1,2) , test(3,4)) as test(1,2) and test(3,4). What can I use as delimiter value instead of x here? Thanks StringTokenizer tokenizer = new StringTokenizer(str, "x");
Mrkrky
  • 73
  • 5
-1
votes
1 answer

df.apply(lambda: x.lower()): 'function' object has no attribute 'lower'

I have written this code in Jupyter, but I get an error message: tokenizer = RegexpTokenizer (r'\w+') career_df['How could the conversation have been more useful?']= career_df['How could the conversation have been more useful?'].apply(lambda…
Praveen
  • 1
  • 1
  • 2
-1
votes
1 answer

How to design and split tokens from the string tokenizer function?

I'm building a calculator that can solve formula's as a project of mine in which i encountered the problem that a string such as 2x+7 will get tokenized as "2x","+" ,"7". I need to properly split it into constants and variables which means 2x should…
-1
votes
3 answers

How do I split or tokenize a string only when 2 delimiters are present together (adjacent to each other)

I am reading in lines,and I need to split each line when the delimiter ; (semicolon + space) is present. Each line is as follows: s1; s2 s3; s4. I want to split this line where ; (semicolon + space) exists. I want to split only where semicolon and…
Danny
  • 77
  • 1
  • 8
-1
votes
1 answer

Define few dependable functions inside one. Python

For example, Data Frame is: df = pd.DataFrame(data = {'id': ['393848', '30495'], 'text' : ['This is Gabanna. @RT Her human Jose rushed past firefighters into his burning home to rescue her. She suffered burns on her nose and…
AlexR
  • 9
  • 1
  • 6
-1
votes
2 answers

Finding two specific numbers in a list using string tokenizer

I'm trying to find two specific numbers (25,55) in a input list by converting them to tokens. e.g. below - string list = (52 98 55 86 42 25 87 566 56 843). Just for context, the numbers are prices for books bought in a week for a library. If they…
hay2009
  • 11
  • 3
-1
votes
1 answer

Java I/O stream reading from .txt file and Skipping first 2 lines (StringTokenizer)

I am trying read text from a .txt file called "Marks.txt" (I attached the file here-> Marks.txt) which contains student data, Like this, thefirst 2 rows are headers or just labels for the data The first two lines are just headers or labels as stated…
reflexez
  • 1
  • 1
  • 3