I just wrote a Qt based php addSlashes function like, I wont to see any improvements, suggestions to it. I am planing to use this function to fill a file with hundred of insert
query, to be more specific, I am going to create php database dump like.
QString addSlashes(QString str)
{
QString newStr;
for(int i=0;i<str.length();i++)
{
if(str[i] == '\0')
{
newStr.append('\\');
newStr.append('0');
}
else if(str[i] == '\'')
{
newStr.append('\'');
}
else if(str[i] == '\"')
{
newStr.append('\"');
}
else if(str[i] == '\\')
{
newStr.append('\\');
}
else
newStr.append(str[i]);
}
return newStr;
}