1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-10 03:30:39 +03:00

Mayaqua/Str: add TrimQuotes() function to remove quotes from a string

This commit is contained in:
Davide Beatrici 2018-10-06 22:42:29 +02:00
parent 9970d6f657
commit 335e0503c9
2 changed files with 28 additions and 0 deletions

View File

@ -2412,6 +2412,33 @@ void TrimCrlf(char *str)
}
}
// Remove quotes at the beginning and at the end of the string
void TrimQuotes(char *str)
{
UINT len = 0;
// Validate arguments
if (str == NULL)
{
return;
}
len = StrLen(str);
if (len == 0)
{
return;
}
if (str[len - 1] == '\"')
{
str[len - 1] = 0;
}
if (str[0] == '\"')
{
Move(str, str + 1, len);
}
}
// Remove white spaces of the both side of the string
void Trim(char *str)
{

View File

@ -155,6 +155,7 @@ bool ToBool(char *str);
int ToInti(char *str);
void ToStr(char *str, UINT i);
void TrimCrlf(char *str);
void TrimQuotes(char *str);
void Trim(char *str);
void TrimRight(char *str);
void TrimLeft(char *str);