lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> I want to use string.find and it returns two numbers, but I do not know how
> to use this return.
> I tried :
> a="cou   cou cou";
> b=string.find(a,"(%s+)");

Try the code below.
	b,e=string.find(a,"(%s+)")

The b will contain 4 and e will contain 6.
b is the start of the first run of spaces in a, e is the end.
	"cou   cou cou";
	 123456789
String positions in Lua start at 1.