Share via

How do I remove ( ) parenthesis from data on VFP 9.0

Larry Nuñez 46 Reputation points
2026-06-23T14:43:44.32+00:00

How do I remove ( ) from data on VFP 9.0. I want to also delete dashes -

Developer technologies | Visual Studio | Other
Developer technologies | Visual Studio | Other

A family of Microsoft suites of integrated development tools for building applications for Windows, the web, mobile devices and many other platforms. Miscellaneous topics that do not fit into specific categories.


1 answer

Sort by: Most helpful
  1. AI answer

    2026-06-23T14:43:55.9866667+00:00

    In Visual FoxPro 9.0, use STRTRAN() to remove specific characters like parentheses and dashes from a character field or string.

    Example for a field called cData in a table:

    * Remove left parenthesis
    REPLACE ALL cData WITH STRTRAN(cData, "(", "")
    
    * Remove right parenthesis
    REPLACE ALL cData WITH STRTRAN(cData, ")", "")
    
    * Remove dashes
    REPLACE ALL cData WITH STRTRAN(cData, "-", "")
    

    To do it in one expression without multiple REPLACE commands:

    REPLACE ALL cData WITH STRTRAN(STRTRAN(STRTRAN(cData, "(", ""), ")", ""), "-", "")
    

    If working with a variable instead of a field:

    lcText = "(123)-456-7890"
    lcText = STRTRAN(STRTRAN(STRTRAN(lcText, "(", ""), ")", ""), "-", "")
    * Result: "1234567890"
    

    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.