diff -r 2b6cd7cd82e3 -r c9f1dc4cdaed core/smn_string.cpp --- a/core/smn_string.cpp Wed Apr 16 05:04:33 2008 +0000 +++ b/core/smn_string.cpp Wed Apr 16 05:27:09 2008 +0000 @@ -560,6 +560,27 @@ return -1; } +static cell_t StripQuotes(IPluginContext *pContext, const cell_t *params) +{ + char *text; + size_t length; + + pContext->LocalToString(params[1], &text); + length = strlen(text); + + if (text[0] == '"' && text[length-1] == '"') + { + /* Null-terminate */ + text[--length] = '\0'; + /* Move the remaining bytes (including null terminator) down by one */ + memmove(&text[0], &text[1], length); + + return 1; + } + + return 0; +} + REGISTER_NATIVES(basicStrings) { {"BreakString", BreakString}, @@ -586,6 +607,7 @@ {"StringToIntEx", StringToIntEx}, {"StringToFloat", sm_strtofloat}, {"StringToFloatEx", StringToFloatEx}, + {"StripQuotes", StripQuotes}, {"TrimString", TrimString}, {"VFormat", sm_vformat}, {NULL, NULL},