java - Printing limited number of words in String -


i new java programming, , having hard time project due in class. have synopsis retrieved netflix wsdl, , task limit large paragraph 10 words.

in other words, code should use limit large string specific number of words?

the tool need string.split() method.

you split string blank space delimiter, i.e. " ", if resultingarray.length <= 10 save first 10, discard rest.

simple :)

edit: not homework service, need show faith. usage of string.split seen below

public static void main(string[] args) {     final string sentence = "this really, really, really, super line";     final string[] words = sentence.split(" ");      for(int = 0; < words.length; i++){         system.out.printf("word %d: %s\n", i, words[i]);     } } 

Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -