FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
strw_rtrimany.c
Go to the documentation of this file.
1
/* rtrimw$ ANY function */
2
3
#include "
fb.h
"
4
5
FBCALL
FB_WCHAR
*
fb_WstrRTrimAny
(
const
FB_WCHAR
*src,
const
FB_WCHAR
*pattern )
6
{
7
const
FB_WCHAR
*pachText;
8
FB_WCHAR
*dst;
9
ssize_t len;
10
11
if
( src ==
NULL
) {
12
return
NULL
;
13
}
14
15
len =
fb_wstr_Len
( src );
16
{
17
ssize_t len_pattern =
fb_wstr_Len
( pattern );
18
pachText = src;
19
while
( len != 0 )
20
{
21
ssize_t i;
22
--len;
23
for
( i=0; i!=len_pattern; ++i ) {
24
if
( wcschr( pattern, pachText[len] )!=
NULL
) {
25
break
;
26
}
27
}
28
if
( i==len_pattern ) {
29
++len;
30
break
;
31
}
32
}
33
}
34
35
if
( len > 0 )
36
{
37
/* alloc temp string */
38
dst =
fb_wstr_AllocTemp
( len );
39
if
( dst !=
NULL
)
40
{
41
/* simple copy */
42
fb_wstr_Copy
( dst, src, len );
43
}
44
else
45
dst =
NULL
;
46
}
47
else
48
dst =
NULL
;
49
50
return
dst;
51
}
rtlib
strw_rtrimany.c
Generated on Thu Jan 23 2014 19:40:13 for FreeBASIC by
1.8.4