FreeBASIC  0.91.0
str_hskip.c
Go to the documentation of this file.
1 #include "fb.h"
2 
3 FBCALL char *fb_hStrSkipChar( char *s, ssize_t len, int c )
4 {
5  char *p = s;
6 
7  if( s != NULL )
8  while( (--len >= 0) && ((int)*p == c) )
9  ++p;
10 
11  return p;
12 }
13 
14 FBCALL char *fb_hStrSkipCharRev( char *s, ssize_t len, int c )
15 {
16  char *p;
17 
18  if( (s == NULL) || (len <= 0) )
19  return s;
20 
21  p = &s[len-1];
22 
23  /* fixed-len's are filled with null's as in PB, strip them too */
24  while( (--len >= 0) && (((int)*p == c) || ((int)*p == 0) ) )
25  --p;
26 
27  return p;
28 }