Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Splitting names
Message
De
26/08/2002 08:26:22
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00693400
Message ID:
00693580
Vues:
27
Thanks. That did exactly what I needed. I don't use VFP as often as I used to so I forget how to do certain things.

Bill

>Bill
>This will work in any version of Fox.
>Assuming your field containing the whole name is NAME, and you add two fields to your table, one with LASTNAME and one with FIRSTNAME, just run the following:
>replace all LASTNAME with left(NAME,at(",",NAME)-1),;
>            FIRSTNAME with right(NAME,len(NAME)-at(",",NAME))
>
>Cheers
>Jaime
>
>>GETWORDNUM doesn't seem to be a function available with VFP 6. Do you know where I can get it?
>>
>>Thanks
>>
>>>Bill,
>>>
>>>I would suggest to add a second name column (ALTER TABLE) to the table after the import. Then you can convert your data as follows:
>>>
>>>
>>>REPLACE new_column WITH ALLTRIM ( GETWORDNUM(original_col, 2, ",") ) ALL
>>>
>>>REPLACE original_col WITH ALLTRIM ( GETWORDNUM(original_col, 1, ",") ) ALL
>>>
>>>
>>>This way, you'll have the firstname in the added column and the lastname in the original column.
>>>
>>>HTH,
>>>Armin
>>>
>>>>Hi, all
>>>>
>>>> I imported an excel spreadsheet into VFP. I need to split a column that contains names into two separate columns. For example:
>>>>
>>>>Name Smith, John
>>>>
>>>>Into
>>>>
>>>>Last_name Smith
>>>>First_name John
>>>>
>>>>Is there a function to do this?
>>>>
>>>>TIA,
William Chadbourne
Senior Programmer/Analyst
State of Maine - DAFS App Team

Oracle - When you care enough to use the very best!!
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform