Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Array Question

Thread Tools

Array Question

Roedy Green
Posts: n/a
On Mon, 28 Jun 2004 22:42:27 +0500, "Asad Kazmi" <(E-Mail Removed)>
wrote or quoted :

>you ammended this part and put index=endindex+1 inside closing braces while
>i put this statement out of braces. so i was refering this as your code.

I see the problem. Superdude made that mod, not me.

Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See for The Java Glossary.
Reply With Quote
Posts: n/a

public static void main(String[] args) {
String mytext="My Name is Asad Raza Kazmi";

int count=0;
int index=0;
char seperator=' '; //Determines the no of substrings
do {
while(index != -1);
// Extract the substring into an array

String[] substr = new String[count]; // Allocate for Substring
index=0; // Substring Start index
int endindex = 0; // Substring endindex
for(int i=0; i<count; i++) {
endindex=mytext.indexOf(seperator,index); //Find next
if(endindex == -1)
index=endindex + 1;

// Display the Substring
for(int i=0; i < substr.length; i++)

Worked fine.
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
const and array of array (of array ...) Mara Guida C Programming 3 09-03-2009 07:54 AM
Question concerning array.array and C++ Fabio Python 0 11-05-2008 03:53 PM
length of an array in a struct in an array of structs in a struct in an array of structs Tuan Bui Perl Misc 14 07-29-2005 02:39 PM
"array of Derived" is not a kind-of "array of Base" question Joseph Turian C++ 11 01-19-2005 11:53 AM
Length of Array of Array of Array Tom Perl Misc 3 12-20-2004 05:23 PM