From 0ec2063b5ad4a6b9574efa6365ac4bf026211e9d Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 13 Jan 2008 11:26:30 +0100 Subject: Added cString::Truncate() --- tools.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'tools.c') 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; -- cgit v1.2.3