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