PBDR.COM

About   -   Contact   -   Purchase   -   Search   -   What's New

 
 
Last Position Function 2

This is a new version of the LastPos function sent in by Pierluigi Ippolito.

/********************************************************************
	Pierluigi Ippolito        		24/02/2001

	gf_last_pos

	<DESC>	Alternative function to find the last position of a
		string in another string</DESC>

	<RETURN>long:
		Position of last as_string2 in string1
		0 if as_string2 does not exist in as_string1</RETURN>

	<ACCESS> Public

	<ARGS>	as_string1: STRING The string in which
			you want search as_string2
		as_string2: STRING The last string you want 
			to seach in as_string 1</ARGS>


********************************************************************/
Long ll_Pos
String ls_string1 , ls_string2

ll_Pos = Pos( as_string1 , as_string2 , 1 )
IF ll_Pos = 0 THEN RETURN 0

ls_string1 = reverse(as_string1)
ls_string2 = reverse(as_string2)

return (len(as_string1) - len(as_string2) &
	-  pos ( ls_string1 , ls_string2) + 2)
 

Top of Page

Legal Notice

Ken Howe 2011