FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
strw_trim.c
Go to the documentation of this file.
1
/* trimw$ function */
2
3
#include "
fb.h
"
4
5
FBCALL
FB_WCHAR
*
fb_WstrTrim
(
const
FB_WCHAR
*src )
6
{
7
FB_WCHAR
*dst;
8
const
FB_WCHAR
*
p
;
9
ssize_t chars;
10
11
if
( src ==
NULL
)
12
return
NULL
;
13
14
chars =
fb_wstr_Len
( src );
15
if
( chars <= 0 )
16
return
NULL
;
17
18
p =
fb_wstr_SkipCharRev
( src, chars,
_LC
(
' '
) );
19
chars =
fb_wstr_CalcDiff
( src, p ) + 1;
20
if
( chars <= 0 )
21
return
NULL
;
22
23
p =
fb_wstr_SkipChar
( src, chars,
_LC
(
' '
) );
24
chars -=
fb_wstr_CalcDiff
( src, p );
25
if
( chars <= 0 )
26
return
NULL
;
27
28
/* alloc temp string */
29
dst =
fb_wstr_AllocTemp
( chars );
30
if
( dst !=
NULL
)
31
{
32
/* simple copy */
33
fb_wstr_Copy
( dst, p, chars );
34
}
35
36
return
dst;
37
}
rtlib
strw_trim.c
Generated on Thu Jan 23 2014 19:40:13 for FreeBASIC by
1.8.4