FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
str_instrrevany.c
Go to the documentation of this file.
1
/* instrrev function */
2
3
#include "
fb.h
"
4
5
FBCALL
ssize_t
fb_StrInstrRevAny
(
FBSTRING
*src,
FBSTRING
*patt, ssize_t start )
6
{
7
ssize_t r = 0;
8
9
if
( (src !=
NULL
) && (src->
data
!=
NULL
) && (patt !=
NULL
) && (patt->
data
!=
NULL
) )
10
{
11
ssize_t size_src =
FB_STRSIZE
(src);
12
ssize_t size_patt =
FB_STRSIZE
(patt);
13
14
if
( (size_src != 0) && (size_patt != 0) && (start != 0) )
15
{
16
if
( start < 0 )
17
start = size_src;
18
else
if
( start > size_src )
19
start = 0;
20
21
while
( start-- && (r == 0) )
22
{
23
ssize_t i;
24
for
( i = 0; i != size_patt; ++i )
25
{
26
if
( src->
data
[start] == patt->
data
[i] )
27
{
28
r = start + 1;
29
break
;
30
}
31
}
32
}
33
}
34
}
35
36
FB_STRLOCK
();
37
38
/* del if temp */
39
fb_hStrDelTemp_NoLock
( src );
40
fb_hStrDelTemp_NoLock
( patt );
41
42
FB_STRUNLOCK
();
43
44
return
r;
45
}
rtlib
str_instrrevany.c
Generated on Thu Jan 23 2014 19:40:13 for FreeBASIC by
1.8.4