Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.excel.programming > #111185

Re: Find position of date in string

From dpb <none@none.net>
Newsgroups microsoft.public.excel.programming
Subject Re: Find position of date in string
Date 2019-10-09 20:29 -0500
Organization Aioe.org NNTP Server
Message-ID <qnm1h8$vsd$1@gioia.aioe.org> (permalink)
References <da45bc2b-80a4-4890-85c4-be164592a39c@googlegroups.com> <qnkgvo$89l$1@dont-email.me> <9ca26d2d-4af2-4908-bc67-e3704fe80cab@googlegroups.com>

Show all headers | View raw


On 10/9/2019 2:01 PM, RG III wrote:
>>
>> Const myStr = "The video shows that on 9/24/2019 the suspect entered
>> the store."
>>
>> i = InStr(myStr, "/")
>> myPos = InStrRev(myStr, " ", i) + 1
>>
>>
> 
> I suppose that works.  It appears to just find the first "/" character
> in a string, is that right?

Yes...not a very robust solution unless it can be assured the search 
string doesn't have other instances of slashes besides.

> And BTW, I made a typo in my above message.  The format of the
> dates is "m/dd/yyyy" or "mm/dd/yyyy".

You still have more work to do with the above even in the given case 
depending upon whether is one- or two-digit month so you've got to 
search back for the whitespace character before the characters before 
the first slash to get the actual beginning of the string, the second 
line in the above.

I dunno VBA well enuf to know otomh--is there a regular expressions 
version of text search besides just simple string pattern matching?  If 
so, would be way to go.

--


Back to microsoft.public.excel.programming | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Find position of date in string RG III <mob.rrr.3@gmail.com> - 2019-10-09 03:13 -0700
  Re: Find position of date in string Claus Busch <claus_busch@t-online.de> - 2019-10-09 13:40 +0200
    Re: Find position of date in string RG III <mob.rrr.3@gmail.com> - 2019-10-09 12:01 -0700
      Re: Find position of date in string dpb <none@none.net> - 2019-10-09 20:29 -0500

csiph-web