I am an OpenEdge (aka Progress) developer that loves clean code and good looking applications that are easy to use. My main pet project is the Progress DataDigger
FUNCTION cleanString RETURNS CHARACTER
(pcString AS CHARACTER):
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DEFINE VARIABLE c AS CHARACTER NO-UNDO.
DO i = 1 TO LENGTH(pcString):
CASE SUBSTRING(pcString,i,1):
WHEN '#' THEN IF c > '' THEN c = SUBSTRING(c, 1, LENGTH(c) - 1).
OTHERWISE c = c + SUBSTRING(pcString,i,1).
END CASE.
END.
RETURN c.
END FUNCTION.
MESSAGE cleanString("abc#def##ghi###") = "abd"
SKIP cleanString("abc#d##c") = "ac"
SKIP cleanString("abc##d######") = ""
SKIP cleanString("#######") = ""
SKIP cleanString("") = ""
VIEW-AS ALERT-BOX INFORMATION BUTTONS OK.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Progress 4GL