Quote:
Originally Posted by Vince
I'd try something like this. Not tested, but if my brain analyzed it correctly it should work.
PHP код:
new
originalString[] = "Text1\nText2\nText3";
new
posStart = -1,
posEnd = 0,
index = 0,
destination[5][110]; // maximum 5 splits
new i;
while(originalString[i++] && index < sizeof(destination)) // loop original string until end or until destination is full
{
// found linefeed
if(originalString[i] == '\n' || originalString[i] == EOS)
{
if(posStart < posEnd)
{
posStart = i;
}
else
{
posEnd = i;
}
if(posEnd > posStart)
{
strmid(destination[index], originalString, posStart, posEnd, sizeof(destination[]));
index++;
}
}
}
|
Thanks so much sir
+repped
Edit: it says you must spread some reputation around... so sorry sir