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

how to split a string_view into multiple string_view objects without any dynamic allocations

The snippet below comes from this answer. #include #include void tokenize(std::string str, std::vector &token_v){ size_t start = str.find_first_not_of(DELIMITER), end=start; while (start != std::string::npos){ …
digito_evo
  • 3,216
  • 2
  • 14
  • 42
1
vote
2 answers

How to get the number of strings stored in a stringstream

I need to test to see if the number of extracted strings from a string_view is equal to a specific number (e.g. 4) and then execute some code. This is how I do it: #include #include #include #include #include…
digito_evo
  • 3,216
  • 2
  • 14
  • 42
1
vote
0 answers

Removing escape characters from tokenised Array using Snowflake SQL

CREATE OR REPLACE VIEW commerce_events_tempview AS SELECT snowflake_loaded_timestamp AS SNOWPIPE_LOADED_TIMESTAMP, snowflake_loaded_timestamp::VARCHAR as CIMBA_LOADEDTIMESTAMP, JSON:cimbaApiVersion::VARCHAR AS cimba_api_version, …
1
vote
1 answer

Inconsistent output from gcount()

I have written the following simple MRE that regenerates a bug in my program: #include #include #include #include #include #include #include // this function is working fine…
digito_evo
  • 3,216
  • 2
  • 14
  • 42
1
vote
0 answers

Solr or Elasticserach catenate_words to generate all combination of catenated tokens

Consider the following case with word delimeter graph token filter and catenate_words set to true I will get the following tokens super-duper-xl → [ superduperxl, super, duper, xl ] However the desired tokens are all sequential combination around…
Yatin
  • 727
  • 1
  • 9
  • 40
1
vote
0 answers

How to extract a number from an existing file using Tokenizer (java)

I have this piece of code to extract lines from an existing file using Tokenizer: String line = ""; StringTokenizer inLine; However, I also need to extract integers. How to I extract integers using Tokenizer?
user388777
  • 11
  • 4
1
vote
1 answer

Unexpected result in StringTokenizer

I have the following code which gives me an unexpected result: String output = "New Record created successfully
Enter stops
"; StringTokenizer st = new StringTokenizer(output); token = st.nextToken("
"); msg1.setText(token); while…
pintu
  • 11
  • 4
1
vote
1 answer

How to replace specific html tags using string tokenizer

I have a string with html markup in it (differMarkup) and would like to run that string through a tokenizer that would identify specific tags (like ins, dels, movs) and replace them with the span tag and add data attributes to it as well. So the…
Dzsonah
  • 125
  • 1
  • 11
1
vote
3 answers

Caused by: java.util.NoSuchElementException

Hello all i am working with following code code is work fine with below string StringTokenizer st = new StringTokenizer("abc,koch, Ranchi, zalkhand, NY, 10001, India"); but when i remove any element in string like = "abc" it show Caused by:…
Prashant Kadam
  • 551
  • 1
  • 12
  • 25
1
vote
2 answers

Split a String by multiple delimiters in java

what is the possible way to split a String by multiple delimiters? Is StringTokenizer can help me out to achieve this? String str="list1|10456103|10456102|10456121#list2|10456105|10456122"; String str="list1|10513846#list2|"; String…
Eternal_Explorer
  • 1,119
  • 3
  • 14
  • 26
1
vote
1 answer

Why are foreign characters not read using inputStream?

I have a text file which contains data I need to preload into a SQLite database. I saved in in res/raw. I read the whole file using readTxtFromRaw(), then I use the StringTokenizer class to process the file line by line. However the String returned…
Sandy
  • 2,572
  • 7
  • 40
  • 61
1
vote
3 answers

How to spilt a sentence using words in StringTokenizer (JAVA)

I have a sentence, which has names of an authors separated by the word "and". I want to remove the "and" and put a & instead. Is there a quick and easy way to do this. I've tried scanner and useDelimiter(), StringTokenizer, and split. This is for…
1
vote
2 answers

Regex , Find the sentence, all of which are capital letters

I need your help. Currently I'm using this code section for my work; altbaslik = [] for line in sentenceIndex: finded = re.match(r"\w*[A-Z]\w*[A-Z]\w*|[Ö|Ç|Ş|Ü|Ğ|İ]", line) if finded != None: finded2 =…
1
vote
1 answer

Are there any differences between using StringTokenizer and concatenating Strings together?

I am using Java to make an Uno game. I have a method called findCard(String cardname) whose function is to find the card in a hand of cards when the user writes in the name of the card (e.g: “Red 6”) and to return null if it can’t find the card. It…
1
vote
2 answers

How do i get a specific value inside a string with StringTokenizer

public void map(Object key, Text value, Context context ) throws IOException, InterruptedException { StringTokenizer itr = new StringTokenizer(value.toString()); while…
zyzdar
  • 11
  • 2