Ravi,

Try something like this:

int FamilyMembers = 4;
         String FirstNames[] = new String[FamilyMembers];
String LastNames[] = new String[FamilyMembers];
String nameArray[] = new String[2];

for (int j=0; j<FamilyMemberNames.length; j++){
    nameArray=FamilyMemberNames[j].split(" ");
    FirstNames[j]=nameArray[0];
    LastNames[j]=nameArray[1];
}


On Mon, Nov 24, 2008 at 7:50 AM, Ravi NS <[EMAIL PROTECTED]> wrote:

> Hi all,
>
> This been a Month and I'm Stuck with this function named Split.
>
> split Defines
> The array of strings computed by  splitting this string around matches of
> the given regular expression
>
> Return Type is String which is Split
>
>
>
> Here is the Code.
>
> ******************************************************************************************************************************
> public class JavaArrayProject {
>
>     /**
>      * @param args the command line arguments
>      */
>     public static void main(String[] args) {
>
>         String []fullName = new String [3];
>
>         //  Input for String for FULL NAME
>
>         for ( int i=1; i<=3 ; i++ )
>         {    fullName [i] = JOptionPane.showInputDialog("Please Enter
> Family Member "+
>                     i + " First and Last Name ");
>         }
>
>         // Split Function for Extracting First Name
>         String []firstName = new String [3] ;
>
>         for (int i=1 ;i<=3 ; i++ )
>           firstName[i] = fullName[i].split(" ");
>
>
>
> ******************************************************************************************************************************
>
> I'm getting a Error in the last line. My logic on that statement is wrong.
> IDE gives me "incompatible types" and it says
>   found : java.lang.string[]
>   required : java.lang.string
>
> My thoughts are like this..
> Full Name  = Ravi Nazre
> So First Name  is Ravi and Last Name is Nazre.
>
> here fullName= Ravi Nazre
> if i Use
> firstName[ ] = fullName[].split(" ");
>
> It should store First Name
>
>
> I'm Still wondering what needs to be done here. I want to use Looping
> Structure for Scalability.
> Please help
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to