|
@@ -105,5 +105,19 @@ static inline void trim(str* _s)
|
|
for(;(_s_).s[0]==' ';(_s_).s=(_s_).s+1,(_s_).len--); \
|
|
for(;(_s_).s[0]==' ';(_s_).s=(_s_).s+1,(_s_).len--); \
|
|
\
|
|
\
|
|
} while(0);
|
|
} while(0);
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * right and left zero trimming
|
|
|
|
+ *
|
|
|
|
+ * WARNING: String structure will be modified !
|
|
|
|
+ * Make a copy otherwise you might be
|
|
|
|
+ * unable to free _s_->s for example !
|
|
|
|
+ */
|
|
|
|
+#define trim_zeros_lr(_s_) \
|
|
|
|
+ do{ \
|
|
|
|
+ for(;(_s_)->s[(_s_)->len-1]=='\0';(_s_)->s[--(_s_)->len]=0); \
|
|
|
|
+ for(;(_s_)->s[0]=='\0';(_s_)->s=(_s_)->s+1,(_s_)->len--); \
|
|
|
|
+ \
|
|
|
|
+ } while(0);
|
|
|
|
+
|
|
#endif /* TRIM_H */
|
|
#endif /* TRIM_H */
|