aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/str
diff options
context:
space:
mode:
authorGravatar Fabio Bas2010-09-05 17:25:24 +0000
committerGravatar Fabio Bas2010-09-05 17:25:24 +0000
commitbe8e770a4bb51db684462a4d03c993abe446d8dc (patch)
tree35761b72b50fb7389e0ecd7776817f50d83b409d /src/modules/str
parentadded popup.create, popup.destroy, $popup.exists() (diff)
downloadKVIrc-be8e770a4bb51db684462a4d03c993abe446d8dc.tar.gz
KVIrc-be8e770a4bb51db684462a4d03c993abe446d8dc.tar.bz2
KVIrc-be8e770a4bb51db684462a4d03c993abe446d8dc.zip
implemented #947
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@4982 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules/str')
-rw-r--r--src/modules/str/libkvistr.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/modules/str/libkvistr.cpp b/src/modules/str/libkvistr.cpp
index 862e33ff3..b141d213d 100644
--- a/src/modules/str/libkvistr.cpp
+++ b/src/modules/str/libkvistr.cpp
@@ -686,7 +686,8 @@ static bool str_kvs_fnc_right(KviKvsModuleFunctionCall * c)
@description:
This function returns a substring of the first string parameter wich is the
string starting at the (numeric) index given with startidx and counting nchars
- forward.
+ forward. If <nchars> is not given or is less than 1, all the characters until
+ the end of the string will be returned.
*/
static bool str_kvs_fnc_mid(KviKvsModuleFunctionCall * c)
{
@@ -695,9 +696,9 @@ static bool str_kvs_fnc_mid(KviKvsModuleFunctionCall * c)
KVSM_PARAMETERS_BEGIN(c)
KVSM_PARAMETER("data",KVS_PT_STRING,0,szString)
KVSM_PARAMETER("startidx",KVS_PT_INTEGER,0,iIdx)
- KVSM_PARAMETER("nchars",KVS_PT_INTEGER,0,iNchars)
+ KVSM_PARAMETER("nchars",KVS_PT_INTEGER,KVS_PF_OPTIONAL,iNchars)
KVSM_PARAMETERS_END(c)
- c->returnValue()->setString(szString.mid(iIdx,iNchars));
+ c->returnValue()->setString(szString.mid(iIdx,iNchars<1?-1:iNchars));
return true;
}