java - Butchering a String word wise -
I am trying to isolate a long string in each word and try to print it sequentially in java I am doing this, but this exception throws You use Code> string in strng = input.nextLine (); Your next test should be on the
public class spell checker {public static zero test (string str) {int i = 0, j = 0, n = str.length (); String floating = ""; Do {for (i = j; str.charAt (i)! = ''; I ++) temp + = str.charAt (i); Floating + = '\ 0'; Println (temporary); Temporary = ""; j = i + 1; } While (J & lt; n); } Public static zero main (string [] args) {java.util.Scanner input = new java.util.Scanner (System.in); System.out.print ("Enter the string for which you want to check spelling:"); String = string = input.next (); Test (strng); }}
next () instead
test () method
public static zero test (string str) {string [] Word = str.split ("\\ s +"); For (string word: word) {System.out.println (word); // decide what you want to do with each word}}
Comments
Post a Comment