FreeBASIC  0.91.0
strw_instrrevany.c
Go to the documentation of this file.
1 /* instrrevanyw function */
2 
3 #include "fb.h"
4 
5 FBCALL ssize_t fb_WstrInstrRevAny( const FB_WCHAR *src, const FB_WCHAR *patt, ssize_t start )
6 {
7  if( (src != NULL) && (patt != NULL) )
8  {
9  ssize_t size_src = fb_wstr_Len(src);
10  ssize_t size_patt = fb_wstr_Len(patt);
11  ssize_t i;
12 
13  if( (size_src != 0) && (size_patt != 0) && (start != 0))
14  {
15  if( start < 0 )
16  start = size_src;
17  else if( start > size_src )
18  start = 0;
19 
20  while( start-- )
21  {
22  for( i = 0; i != size_patt; ++i )
23  if( src[start] == patt[i] )
24  return start + 1;
25  }
26  }
27  }
28 
29  return 0;
30 }