473,469 Members | 1,590 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

move a text field to an array - search one element at a time

16 New Member
I need to search a text field for dates and move them to date fields. I am sure I have done this in the past using arrays but can't remember how I did it. here is a sample text fields.

"perfect attendance 2nd qtr, remove 1 occurrence (08/09/05 & 1/2 of 10/14/05)"
"Perfect Attendance 1st Qtr, remove 1 occurrence (09/12/05)"
Thanks to anyone woh can help.

JH001A.
Oct 16 '06 #1
3 1790
PEB
1,418 Recognized Expert Top Contributor
Yeah, you can save the obtained dates in an array...

So your function can be like:
Global mydates(20)

Function save_date_in_array(Stri) as integer
dim i
dim dd

dd=0
for i=1 to len(Stri)-8
if isdate(mid(Stri,i,8))= true then
dd=dd+1
mydates(dd)=CVDate(mid(Stri,i,8))
end if
next i
save_date_in_array=dd
End function

Best regards
Oct 21 '06 #2
JH001A
16 New Member
Yeah, you can save the obtained dates in an array...

So your function can be like:
Global mydates(20)

Function save_date_in_array(Stri) as integer
dim i
dim dd

dd=0
for i=1 to len(Stri)-8
if isdate(mid(Stri,i,8))= true then
dd=dd+1
mydates(dd)=CVDate(mid(Stri,i,8))
end if
next i
save_date_in_array=dd
End function

Best regards

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Thanks for the reply.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 25 '06 #3
Killer42
8,435 Recognized Expert Expert
dd=0
for i=1 to len(Stri)-8
if isdate(mid(Stri,i,8))= true then
dd=dd+1
mydates(dd)=CVDate(mid(Stri,i,8))
end if
next i
Just a minor point - you probably should adjust i after grabbing a date, just to avoid reprocessing the same text unnecessarily. At a guess, adding 8 to it would do the trick.

Also, a question - is it possible the dates could be in different formats? Or to put it another way, are they manually entered, or generated by a program?
Oct 25 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Tyrone Slothrop | last post by:
I am coding a search form which carries the values to an identical form on the search results page. A "Clear Fields" button to remove the values from the previous search is required. Ideally I...
5
by: simon_s_li | last post by:
Hi, I have 5 fields in line where I need to drag and drop the text from one field to another field and then all the fields need to re-order themselves. So for instance if I drag the text in...
46
by: RoSsIaCrIiLoIA | last post by:
Write a function that gets an array of unsigned int fill it with random values all differents, and sorts it. It should be faster than qsort too. Do you like my solution? _______________________...
7
by: simkn | last post by:
Hello, I'm writing a function that updates an array. That is, given an array, change each element. The trick is this: I can't change any elements until I've processed the entire array. For...
2
by: Sethos | last post by:
I am sure that this has been covered, hashed, and rehashed, but a search on the group did not produce the answer, so forgive me if this seems like a "newbie" type question... Besically, I have a...
1
by: sven.daems | last post by:
Hy I want to add a sort of news service to my site. I've a number of messages, wich I want to be shown in a <marquee> tag. I've found a simple scrit that generates an random message (wich I've...
7
by: Chuck Anderson | last post by:
I'm pretty much a JavaScript novice. I'm good at learning by example and changing those examples to suit my needs. That said .... ..... I have some select fields in a form I created for a...
12
by: David | last post by:
Hi, I am trying to achieve the following: 1/ To have a standard form in an asp web page which has various check boxes and radio buttons. As a user selects a form item it updates a text box,...
1
by: stoogots2 | last post by:
I have written a Windows App in C# that needs to read a text file over the network, starting from the end of the file and reading backwards toward the beginning (looking for the last occurrence of a...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.