diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2008-01-13 11:26:30 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2008-01-13 11:26:30 +0100 |
commit | 0ec2063b5ad4a6b9574efa6365ac4bf026211e9d (patch) | |
tree | 79074c624baf92376cababeb26af52d2d288149b /tools.c | |
parent | fe2568082a3a6df7d6b9fa88d83942fbd701c9b4 (diff) | |
download | vdr-0ec2063b5ad4a6b9574efa6365ac4bf026211e9d.tar.gz vdr-0ec2063b5ad4a6b9574efa6365ac4bf026211e9d.tar.bz2 |
Added cString::Truncate()
Diffstat (limited to 'tools.c')
-rw-r--r-- | tools.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: tools.c 1.139 2008/01/01 15:10:07 kls Exp $ + * $Id: tools.c 1.140 2008/01/13 11:26:30 kls Exp $ */ #include "tools.h" @@ -873,6 +873,16 @@ cString &cString::operator=(const cString &String) return *this; } +cString &cString::Truncate(int Index) +{ + int l = strlen(s); + if (Index < 0) + Index = l + Index; + if (Index >= 0 && Index < l) + s[Index] = 0; + return *this; +} + cString cString::sprintf(const char *fmt, ...) { va_list ap; |