Search code examples
visual-foxprofoxpro

FoxPro Deleting after specific


I am trying to replace text after "/" on foxpro. Shelly Jones/Foundation Director, How to delete everything after the "/"?


Solution

  • A common way of doing it is to combine the left() and atc() functions, like so:

    lcStr = "Shelly Jones/Foundation Director"
    lcNewStr = LEFT(lcStr, ATC('/', lcStr) - 1)
    

    The -1 is needed to get the portion of the string ending before the / character.