Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Stumped
Message
De
23/04/1998 16:30:07
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00094441
Message ID:
00094469
Vues:
27
>>>>>>My brain must be fried today or something. What is the command to obtain the location of the rightmost character(other than a space) in a field. Example, a 25 character field with city and state separated by a space between city and state. If I grab the last two valid characters in the field, I have the state. I can't use the AT function because some cities are two words.
>>>>>>
>>>>>>HELP. I know that this is a no brainer! Thanks everyone
>>>>>>
>>>>>>Bill
>>>>>
>>>>>cString=table1.field1
>>>>>? substr(cString,len(rtrim(cString))-1,2 )
>>>>
>>>>
>>>>Hmmm, I thought it was a one word function. Must have been that way in another life. Thanks so much for the response.
>>>>
>>>>Bill
>>>
>>>Ok, take another one:
>>>? right(alltrim(cString),2)
>>
>>Now that I think about it, I'll use the first one. I can charge more money for it because it looks more complex!
>
>OK, I'm back on. Now that I (well really you, Ed) have successfully parsed the last two characters on the string, I'm trying to clean those characters off of the string and replace the field with just the city. I tried this statement, thinking that it would work:
>
>replace inscityst with substr(inscityst,1,len(rtrim(inscityst)-2)
>
>I get the message "function name missing". What did I do wrong?

Check your parentheses:
replace inscityst with left(inscityst,len(rtrim(inscityst))-2)
Edward Pikman
Independent Consultant
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform