On 5/3/07, Norman Palardy <[EMAIL PROTECTED]> wrote:
> Since I added the test for 2 separators try replacing this code > > // the string should be exactly 2 chars long now > if len(tmp) <> 2 then > // unable to understand the format entered > return false > end if > > sep = mid(tmp,1,1) > if sep <> mid(tmp,2,1) then > // invalid - two different separators > return false > end if > > //make array of elements > Dim dats() as String = Split( text, sep ) > > if UBound( dats ) <> 2 then > //invalid date - should never get here. > Return false > end if > > with this code > > // first figure out what separator they gave us .. have to both be > the same one > for i = 0 to 9 > tmp = replaceAll(tmp,format(i,"0"),"") > next > > select case len(tmp) > case 0 > // unable to understand the format entered > return false > case 1 > sep = tmp > case 2 > > sep = mid(tmp,1,1) > if sep <> mid(tmp,2,1) then > // invalid - two different separators > return false > end if > > else > return false > end select > > //make array of elements > Dim dats() as String = Split( text, sep ) > > if UBound( dats ) <> 2 then > // add in the missing year ? > dim tmpDate as new date > dats.Insert yearPos, format(tmpDate.year,"0000") > end if > > if UBound( dats ) <> 2 then > //invalid date - should never get here. > Return false > end if I think you may also need to add a check for YearPos = 2. I included that in my code, which I'm happy to send as a complete package to you or Steve. I've got to get some other work done this morning, so I don't have time for much more than sending it out to one (or both) of you at the moment. That also explains the qualification in my first sentence. I scanned your code, without analyzing it thoroughly, so you may have already compensated for the YearPos factor without my realizing it. _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives: <http://support.realsoftware.com/listarchives/lists.html>
