Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

string truncation 2

Status
Not open for further replies.

ejhemler

Programmer
Aug 30, 2002
68
US
I'm using foxpro 6.0. I have a string where i need to delete the two rightmost characters from it. I have a string that holds a street name but the direction(N,S,E,W)is at the end of the string and I need it to be at the beginning. The string looks like this.

'ELM ST S'

I need the string to look like this

'S ELM ST'

So far, I've put the ' S' from the end in a separate string and then i plan on moving it to the front. But I can't figure out how to get rid of the ' S' at the end.

Is there a command that will delete a specified amount of characters from the rightmost position? I've all ready tried using chrtran() and strtran() functions but these do not work in my case.

Thanks,
Erik
 
HI

Hi

myNewString = RIGHT(ALLT(myOldString),1) + ;
LEFT(ALLT(myOldString),LEN(ALLT(myOldString))-1)

I think even Christ code has got to be changed to the last character 1 instead of 2. Both should work.
:)

ramani :)
(Subramanian.G)
 
ramani

'I think even Chris code has got to be changed to the last character 1 instead of 2.'

It works as original or alternatively :-

lcStreet = [ELM ST S]
lcStreet = RIGHT(lcStreet,1)
[tab]+ [ ]
[tab]+ LEFT(lcStreet,LEN(lcStreet) - 2)


FAQ184-2483 - the answer to getting answered.​
Chris [pc2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top