openedge - How to check if string is a palindrome in open edge progress 4gl -
how can check whether given string palindrome or not in open edge progress 4gl? there reverse string function built-in progress 4gl?
function reversestring returns character ( input i_c character ): define variable cresult character no-undo. define variable ii integer no-undo. ii = length( i_c ) 1 -1: cresult = cresult + substring( i_c, ii, 1 ). end. return cresult. end function. display reversestring( "asdf" ).
the complete openedge doc set can found here:
as can see, there no built-in reverse string function.
a function 1 illustrate above need.
to determine if string palindrome using function:
mystring = "asdf". if mystring = reversestring( mystring ) message "yes," mystring "is palindrome". else message "no," mystring "is not palindrome".
Comments
Post a Comment