On Sat, Oct 16, 2010 at 7:43 PM, Maxime Chupin
<mc@melusine.eu.org> wrote:
Hi,
I don't really inderstand how work %s. For example, I wrote this code (probabely, it is not a a beautiful code :-)) :
--------------------------------------------------------
<snip>
t="cou cou2 co\nu3 cou4 ";
a={};
a=split(t,"(%s+)");
print("1 : "..a[1]);
print("2 : "..a[2]);
print("3 : "..a[3]);
print("4 : "..a[4]);
print("5 : "..a[5]);
-------------------------------------------------------------
Why does not it work as I want ? %s is not only for the space ?
Based on the result, I'd say that it includes newline and carriage return characters. I'd suggest you just use the plain space character (there doesn't seem to be any escaping of the space character necessary as it's not a regular _expression_) to match whitespace. For example:
Where you would replace <TAB> with an actual tab character.
Regards, James.