calculating each words length and picking words with ceratin letter in them - string array manipulation
in
Programming Questions
•
2 years ago
How do I count the letters per word of a string array:
Example:
Given an array of type:
would return:
an array of type:
int [] wordlenghts = new int[5]
"5, 2, 1, 3, 9" // word lengths per word
-----------------------------------
and how about if I wanted to pick only the words which contain letter "a"
so this time I would have the program return
string [] wordswitha = new string[number of words with the letter a in it]
"a, cat"
-------------------------
is there a more advanced string manipulation library for these types
of processes...
obviously I am a newbie :) I will appreciate your help and guidance
Example:
Given an array of type:
String[] sentence = new String[5]There is a cat somewhere
With this sentence in it:
would return:
an array of type:
int [] wordlenghts = new int[5]
"5, 2, 1, 3, 9" // word lengths per word
-----------------------------------
and how about if I wanted to pick only the words which contain letter "a"
so this time I would have the program return
string [] wordswitha = new string[number of words with the letter a in it]
"a, cat"
-------------------------
is there a more advanced string manipulation library for these types
of processes...
obviously I am a newbie :) I will appreciate your help and guidance
1