From: Maw on 3 Jun 2010 10:33 Hi all, I'm looking a way to exit from the DO loop when the line finish. I read this line from a TXT file and i use ; to split che parameter. I need know how many ; there are in one line. Ex: line: test1;test2;test3;test4 result 3 (3 ; in the line) Someone can help me??? thx in advance. Maw
From: Pegasus [MVP] on 3 Jun 2010 10:40 "Maw" <maw81maw(a)gmail.com> wrote in message news:663ec1d3-b10c-4a62-a343-e80c504fdd2b(a)g19g2000yqc.googlegroups.com... > Hi all, > I'm looking a way to exit from the DO loop when the line finish. > I read this line from a TXT file and i use ; to split che parameter. > I need know how many ; there are in one line. > > Ex: > line: test1;test2;test3;test4 > result 3 (3 ; in the line) > > Someone can help me??? > > thx in advance. > > Maw > Let's have a look at the code you've got so far.
From: Tom Lavedas on 3 Jun 2010 10:43 On Jun 3, 10:33 am, Maw <maw81...(a)gmail.com> wrote: > Hi all, > I'm looking a way to exit from the DO loop when the line finish. > I read this line from a TXT file and i use ; to split che parameter. > I need know how many ; there are in one line. > > Ex: > line: test1;test2;test3;test4 > result 3 (3 ; in the line) > > Someone can help me??? > > thx in advance. > > Maw There is a Split() function that can easily do the parsing, without a loop. It places the result in an Array. The size of the array is found using the UBound() function. For example, ... line = "test1;test2;test3;test4" aLine = split(line, ";") wsh.echo "result:", UBound(aLine) See the WSH documentation for more information about these two functions ... WSH 5.6+ documentation download (URL all one line) http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en _____________________ Tom Lavedas
From: Maw on 3 Jun 2010 11:11 On 3 Giu, 16:43, Tom Lavedas <tglba...(a)verizon.net> wrote: > On Jun 3, 10:33 am, Maw <maw81...(a)gmail.com> wrote: > > > Hi all, > > I'm looking a way to exit from the DO loop when the line finish. > > I read this line from a TXT file and i use ; to split che parameter. > > I need know how many ; there are in one line. > > > Ex: > > line: test1;test2;test3;test4 > > result 3 (3 ; in the line) > > > Someone can help me??? > > > thx in advance. > > > Maw > > There is a Split() function that can easily do the parsing, without a > loop. It places the result in an Array. The size of the array is > found using the UBound() function. For example, ... > > line = "test1;test2;test3;test4" > aLine = split(line, ";") > wsh.echo "result:", UBound(aLine) > > See the WSH documentation for more information about these two > functions ... > WSH 5.6+ documentation download (URL all one line)http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207... > > _____________________ > Tom Lavedas Thx to all, Tom you are my hero...hehehe This code work fine, thx a lot
|
Pages: 1 Prev: Set Word Complex Scripts Options Next: Read Text file, display output |