FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
strw_ltrimany.c
Go to the documentation of this file.
1
/* ltrimw$ ANY function */
2
3
#include "
fb.h
"
4
5
FBCALL
FB_WCHAR
*
fb_WstrLTrimAny
(
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
for
( i=0; i!=len_pattern; ++i ) {
23
if
( wcschr( pattern, *pachText )!=
NULL
) {
24
break
;
25
}
26
}
27
if
( i==len_pattern ) {
28
break
;
29
}
30
--len;
31
++pachText;
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, pachText, len );
43
}
44
else
45
dst =
NULL
;
46
}
47
else
48
dst =
NULL
;
49
50
return
dst;
51
}
rtlib
strw_ltrimany.c
Generated on Thu Jan 23 2014 19:40:13 for FreeBASIC by
1.8.4