Skip to content

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&#82…

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 proble…

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 …