Laxkit  0.0.7.1
strmanip.h
1 //
2 //
3 // The Laxkit, a windowing toolkit
4 // Please consult http://laxkit.sourceforge.net about where to send any
5 // correspondence about this software.
6 //
7 // This library is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU Library General Public
9 // License as published by the Free Software Foundation; either
10 // version 2 of the License, or (at your option) any later version.
11 //
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // Library General Public License for more details.
16 //
17 // You should have received a copy of the GNU Library General Public
18 // License along with this library; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 //
21 // Copyright (C) 2004-2007 by Tom Lechner
22 //
23 #ifndef _LAX_STRMANIP_H
24 #define _LAX_STRMANIP_H
25 
26 #include <cstring>
27 
28 int isblank(const char *str);
29 char *itoa(int a,char *dest,int base=10); /* does not null terminate */
30 char *numtostr(int num, int par=0);
31 char *numtostr(double num, int par=0); /* par=1 => (5) not 5 */
32 char *numtostr(char *dest,int buflen,double num,int par=0);
33 char *newstr(const char *str);
34 char *newnstr(const char *str,int n);
35 char *makestr(char *&dest,const char *src);
36 char *makenstr(char *&dest,const char *src,unsigned int n);
37 char *insertstr(char *&dest,const char *data,int atpos);
38 char *prependnstr(char *&dest,const char *src,int n);
39 char *prependstr(char *&dest,const char *src);
40 char *appendnstr(char *&dest,const char *src,int n);
41 char *appendstr(char *&dest,const char *src);
42 char *appendintstr(char *&dest,int srci);
43 char *appendline(char *&dest,const char *src);
44 char *extendstr(char *&dest,int n);
45 char *extendstr(char *&dest,int &curmax,int n); /* assumes curmax>strlen */
46 char *stripws(char *dest,char where=3);
47 int squish(char *exprs,int p1,int p2); /* remove p1-p2, including p2 */
48  /* doesn't create new str */
49  /* returns #chars removed */
50 char *replace(char *&dest,const char *data,int s,int e,int *newe);
51  /* put in [p1,p2], p2=new p2 */
52 char *replaceall(const char *dest,const char *old,const char *newn,int s=0,int e=-1);
53 char *replaceallname(const char *dest,const char *old,const char *newn);
54 char *getnamestring(const char *buf);
55 void deletestrs(char **&strs,int n);
56 char **splitspace(const char *stro,int *n_ret);
57 char **splitonspace(char *stro,int *n_ret);
58 char **split(const char *str,char delim,int *n_ret);
59 char **spliton(char *str,char delim,int *n_ret);
60 
61 int is_absolute_path(const char *file);
62 const char *lax_basename(const char *path);
63 char *lax_dirname(const char *path,char appendslash);
64 char *increment_file(const char *file);
65 
66 #endif
67 

Mon Feb 17 2014 11:52:57, Laxkit