08.09.2010, 15:56
Nice function, but why don't you escape them instead of adding whitespace?
This is an escape function made by ******:
This is an escape function made by ******:
Код:
#define MAX_INI_ENTRY_TEXT 80 stock DB_Escape(text[]) { new ret[MAX_INI_ENTRY_TEXT * 2], ch, i, j; while ((ch = text[i++]) && j < sizeof (ret)) { if (ch == '\'') { if (j < sizeof (ret) - 2) { ret[j++] = '\''; ret[j++] = '\''; } } else if (j < sizeof (ret)) { ret[j++] = ch; } else { j++; } } ret[sizeof (ret) - 1] = '\0'; return ret; }