Prev: Virtual memory increasing.
Next: Print Server
From: Webbiz on 9 Mar 2010 02:33 I've done parsing where you have one delimiter such as a comma or space. What if you have more than one? Example data: sStr(0) = "3/9" sStr(1) = "3/11 3/15-" sStr(2) = "3/8+ 3/12" sStr(3) = "3/9 3/15" sStr(4) = "3/8- 3/10+ 3/15" The strings above are Month/Day with some having an additional - or + character next to it. These dates are extracted from Excel cells as strings. I need to break those strings down into individual dates. So for sStr(4), I need to parse out "3/8", "3/10" and "3/15". The - and + are not to be returned. My thinking is this: 1. To first run the usual parse routine where the delimiter is the SPACE character. This will break it up into "3/8-", "3/10+" and "3/15". 2. Run each through another filter that looks for either the - or + and simply removes it. Is this how you would do it? Thanks. Webbiz
From: Michael Cole on 9 Mar 2010 02:56 Webbiz wrote: > I've done parsing where you have one delimiter such as a comma or > space. [SNIP] > My thinking is this: > > 1. To first run the usual parse routine where the delimiter is the > SPACE character. This will break it up into "3/8-", "3/10+" and > "3/15". Yep - Easiest way is to use the Split comand. > 2. Run each through another filter that looks for either the - or + > and simply removes it. Use the Replace command twice - note that it would make more sense to do this first on the entire string before performing the Split. -- Regards, Michael Cole
From: Jimekus on 9 Mar 2010 04:22 First, I would make sure that the vbtab delimiter comes with the Excel data and, after a couple of little sizing loops to count the vbtab and vbcr characters, I would put the lot into the Table.Clip property of a flexgrid control. This way you have better control of each string to a cell.
From: Nobody on 9 Mar 2010 04:42 "Webbiz" <nospam(a)noway.com> wrote in message news:70ubp55t1abq2fc18q02iafcu1e6e9b396(a)4ax.com... > My thinking is this: > > 1. To first run the usual parse routine where the delimiter is the > SPACE character. This will break it up into "3/8-", "3/10+" and > "3/15". > > 2. Run each through another filter that looks for either the - or + > and simply removes it. > > Is this how you would do it? I would do it like you suggested, but add an additional validation step by using IsDate() function and show the user a message where the invalid data are.
From: Larry Serflaten on 9 Mar 2010 08:55
"Webbiz" <nospam(a)noway.com> wrote > My thinking is this: > > 1. To first run the usual parse routine where the delimiter is the > SPACE character. This will break it up into "3/8-", "3/10+" and > "3/15". > > 2. Run each through another filter that looks for either the - or + > and simply removes it. > > Is this how you would do it? I would do the reverse, first filter out anything that is not a number or the / and replace them with spaces. Then reduce any multi-space sections to just one space. Then when you use Split, they each fall into their own array element. Reasoning: If you use Split first, you end up with one or more items you have to filter. Say, on average, you end up with three items. That means (on average) you run Split once and Filter three times. If you filter the string first then no matter how many items there are, each string gets one pass through the filter and one pass through Split. LFS |