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.
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: