Applies To:
  • CitectSCADA

Summary:
Is it possible to search for one or more characters in a string starting at the end of the string instead of the beginning, like StrSearch() does?  

Solution:
The attached StrSearchRev() Cicode function works like the Visual Basic InStrRev() function. It will return the character number (starting with 0) of the last occurrance of the find string in the specified text. It simply calls StrSearch() for each character in the string, from the last character (or the specified character numbr) to the first character until a match is found. Another method is to reverse the text string and the find string, then just call StrSearch() once. Although the second method sounds more efficient, the time to reverse the strings makes it slower in most cases.  

Keywords: