This commit is contained in:
twinaphex 2015-07-24 22:55:56 +02:00
parent 51e7a3a187
commit 04404bfe38
2 changed files with 0 additions and 63 deletions

View File

@ -219,62 +219,3 @@ void MDFN_trim(char *string)
MDFN_rtrim(string);
MDFN_ltrim(string);
}
// Remove whitespace from beginning of string
void MDFN_ltrim(std::string &string)
{
size_t len = string.length();
size_t di, si;
bool InWhitespace = TRUE;
di = si = 0;
while(si < len)
{
if(InWhitespace && (string[si] == ' ' || string[si] == '\r' || string[si] == '\n' || string[si] == '\t' || string[si] == 0x0b))
{
}
else
{
InWhitespace = FALSE;
string[di] = string[si];
di++;
}
si++;
}
string.resize(di);
}
// Remove whitespace from end of string
void MDFN_rtrim(std::string &string)
{
size_t len = string.length();
if(len)
{
size_t x = len;
size_t new_len = len;
do
{
x--;
if(!(string[x] == ' ' || string[x] == '\r' || string[x] == '\n' || string[x] == '\t' || string[x] == 0x0b))
break;
new_len--;
} while(x);
string.resize(new_len);
}
}
void MDFN_trim(std::string &string)
{
MDFN_rtrim(string);
MDFN_ltrim(string);
}

View File

@ -16,10 +16,6 @@ void MDFN_ltrim(char *string);
void MDFN_rtrim(char *string);
void MDFN_trim(char *string);
void MDFN_ltrim(std::string &string);
void MDFN_rtrim(std::string &string);
void MDFN_trim(std::string &string);
typedef enum
{
MDFNMKF_STATE = 0,