summaryrefslogtreecommitdiff
path: root/tools.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2008-01-13 11:26:30 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2008-01-13 11:26:30 +0100
commit0ec2063b5ad4a6b9574efa6365ac4bf026211e9d (patch)
tree79074c624baf92376cababeb26af52d2d288149b /tools.c
parentfe2568082a3a6df7d6b9fa88d83942fbd701c9b4 (diff)
downloadvdr-0ec2063b5ad4a6b9574efa6365ac4bf026211e9d.tar.gz
vdr-0ec2063b5ad4a6b9574efa6365ac4bf026211e9d.tar.bz2
Added cString::Truncate()
Diffstat (limited to 'tools.c')
-rw-r--r--tools.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/tools.c b/tools.c
index 79b7c347..98d2501f 100644
--- a/tools.c
+++ b/tools.c
@@ -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;