$FUNCNAME$
  RAT()
$CATEGORY$
  STRING
$SUMMARY$
   Return the position of the last occurrence of a substring
$LANG_RU$
       .
$SYNTAX$
     RAT(<cSearch>, <cTarget>) --> nPosition
$LANG_RU$
     RAT(< >, <>) -->  
$ARGUMENTS$
     <cSearch> is the character string to be located.
     <cTarget> is the character string to be searched.
$LANG_RU$
     < > -   ,  
      .
     <> -   ,    .
$RETURNS$
     RAT() returns the position of <cSearch> within <cTarget> as an integer
     numeric value.  If <cSearch> is not found, RAT() returns zero.
$LANG_RU$
     RAT()   ,   <
     >  ,   <>   
     .      ,  RAT()  .
$DESCRIPTION$
     RAT() is a character function that returns the position of the last
     occurrence of a character substring within another character string.  It
     does this by searching the target string from the right.  RAT() is like
     the AT() function, which returns the position of the first occurrence of
     a substring within another string.  RAT() is also like the $ operator,
     which determines whether a substring is contained within a string.

     Both the RAT() and AT() functions are used with SUBSTR(), LEFT(), and
     RIGHT() to extract substrings.
$LANG_RU$
     RAT() -   ,    
           . 
        . RAT()   
     AT(),        
     . RAT()     $,  ,
         .

       -  RAT(),  AT(),     
     SUBSTR(), LEFT()  RIGHT()   .
$EXAMPLES$

       This example uses RAT() to create a user-defined function,
	FilePath(), that extracts the path from a file specification.  If the
	path is unspecified, FilePath() returns a null string (""):

	? FilePath("C:\DBF\Sales.dbf")      // Result: C:\DBF\

	FUNCTION FilePath( cFile )
	   LOCAL nPos, cFilePath
	   IF (nPos := RAT("\", cFile)) != 0
	      cFilePath = SUBSTR(cFile, 1, nPos)
	   ELSE
	      cFilePath = ""
	   ENDIF
	   RETURN cFilePath


$LANG_RU$

            FilePath(),
             . 
         , FilePath()    (""):

       ? FilePath("C:\DBF\Sales.dbf")     //: C:\DBF\

       FUNCTION FilePath(cFile)
	  LOCAL nPos, cFilePath
	  IF (nPos := RAT("\", cFile)) != 0
	     cFilePath=SUBSTR(cFile, 1, nPos)
	  ELSE
	     cFilePath = ""
	  ENDIF
	  RETURN cFilePath


$SEEALSO$
  RIGHT(),STRTRAN(),SUBSTR(),AT(),LEFT()
$END$
