summaryrefslogtreecommitdiffstats
path: root/qtools/scstring.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qtools/scstring.cpp')
-rw-r--r--qtools/scstring.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/qtools/scstring.cpp b/qtools/scstring.cpp
index 4a36755..18a5492 100644
--- a/qtools/scstring.cpp
+++ b/qtools/scstring.cpp
@@ -643,6 +643,21 @@ void SCString::msg_index( uint index )
#endif
}
+bool SCString::stripPrefix(const char *prefix)
+{
+ if (prefix==0) return FALSE;
+ uint plen = qstrlen(prefix);
+ if (m_data && qstrncmp(prefix,m_data,plen)==0) // prefix matches
+ {
+ uint len = qstrlen(m_data);
+ uint newlen = len-plen+1;
+ qmemmove(m_data,m_data+plen,newlen);
+ resize(newlen);
+ return TRUE;
+ }
+ return FALSE;
+}
+
//---------------------------------------------------------------------------
void *qmemmove( void *dst, const void *src, uint len )