1.1 --- a/core/smn_string.cpp Wed Apr 16 05:04:33 2008 +0000
1.2 +++ b/core/smn_string.cpp Wed Apr 16 05:27:09 2008 +0000
1.3 @@ -560,6 +560,27 @@
1.4 return -1;
1.5 }
1.6
1.7 +static cell_t StripQuotes(IPluginContext *pContext, const cell_t *params)
1.8 +{
1.9 + char *text;
1.10 + size_t length;
1.11 +
1.12 + pContext->LocalToString(params[1], &text);
1.13 + length = strlen(text);
1.14 +
1.15 + if (text[0] == '"' && text[length-1] == '"')
1.16 + {
1.17 + /* Null-terminate */
1.18 + text[--length] = '\0';
1.19 + /* Move the remaining bytes (including null terminator) down by one */
1.20 + memmove(&text[0], &text[1], length);
1.21 +
1.22 + return 1;
1.23 + }
1.24 +
1.25 + return 0;
1.26 +}
1.27 +
1.28 REGISTER_NATIVES(basicStrings)
1.29 {
1.30 {"BreakString", BreakString},
1.31 @@ -586,6 +607,7 @@
1.32 {"StringToIntEx", StringToIntEx},
1.33 {"StringToFloat", sm_strtofloat},
1.34 {"StringToFloatEx", StringToFloatEx},
1.35 + {"StripQuotes", StripQuotes},
1.36 {"TrimString", TrimString},
1.37 {"VFormat", sm_vformat},
1.38 {NULL, NULL},