Skip to content
Advertisement

Tag: string

Find certain numbers in a String and add them in separate ints

I need a way to take specific “random” numbers from a string and put them each in separate int variables. For example this string cannot/shouldnt be changed: String date = “59598 22-01-19 22:46:32 00 0 0 66.2 UTC(NIST) * “; I need these three numbers in separet ints “22-01-19”. So one int would be called “day” and it holds the

Why does my code about Bracket Fixing hangs?

My code makes an incomplete combination of expressions with closing brackets”)” to a complete combination of expressions with the right placement of Opening Brackets “(“. If closing brackets and opening brackets are still not equal, make the first expressions to the last a priority, if still not equal, make an opening bracket to the first index. Three expressions maximum (expression

Finding the longest word ArrayList /Java

I want to write a method which finds the longest String (word). The output should be the longest word in case of two words with the same lenght the output should be: “More than one longest word”. I used ArrayList and almost had a solution, but something goes wrong. The case is that I have a problem when two words

Java – Check if user input partialy matches another string?

I have a problem where i want to see if the input user has enterd partially matches, or as long as majority matches with the answer, if it does then it should print out “Almost correct”. For example lets say the answer is Football, but user instead puts in Footbol. It should then print out Almost correct. here is what

Java – JTextArea refuses to print strings that are just whitespace [closed]

Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed last year. Improve this question I have written a command terminal using Swing components. The snippets of code below

Java Generics – Type must be from Class T “or” extend S

I am developing a ComboBox (more for context than actual significance), and I would like to know if the “or” operator exists in Java generics. For now, the declaration looks something like that: Where ComboBoxItem is an interface I created for items that can be used in the ComboBox. However, I’d also like to accept String as a type, which

Advertisement