I'm having trouble with ARRAY SCAN.
I've created a string array, and I'm trying to find the array element that contains the character string "Date:"
This seems like such a basic thing, I'm embarrassed to post, but I've studied the manual and searched the message board... so here goes.
I'm using vers 9.01.
Here's my code:
The array is populated by reading a simple text file. Here's a sample:
When my code is run the arr_index that is returned is zero.
What am I doing wrong?
Thanks.
-- tom
I've created a string array, and I'm trying to find the array element that contains the character string "Date:"
This seems like such a basic thing, I'm embarrassed to post, but I've studied the manual and searched the message board... so here goes.
I'm using vers 9.01.
Here's my code:
Code:
#COMPILE EXE #DIM ALL FUNCTION PBMAIN () AS LONG DIM infile AS STRING DIM reg_date AS STRING DIM source_txt AS STRING DIM line_count AS LONG DIM arr_index& source_txt = "" source_txt = INPUTBOX$("Enter fully justified source TXT filename","Source file?") IF source_txt = "" THEN EXIT FUNCTION END IF OPEN source_txt FOR INPUT AS #1 'i.e. open message previously saved as text IF ERR THEN MSGBOX "Could not open source file",,"Unable to open file" EXIT FUNCTION END IF 'get line count FILESCAN #1, RECORDS TO line_count 'now read the lines of the message into an array DIM msgline(1 TO line_count) AS STRING LINE INPUT #1, msgline$() TO line_count 'populate the array CLOSE #1 'close source message text file 'reg_date ARRAY SCAN msgline(), ="Date:", TO arr_index& 'find line containing the string date: MSGBOX "array index: " + STR$(arr_index) 'returns 0 EXIT FUNCTION END FUNCTION
Code:
MessageEarthLink.net | My Start Page | myVoice | My Account | Support | Message ‹ Previous | Next › | « Back to INBOX Forward... inline text as attachment Move to... Trash More Actions... View Headers View Source --------------- Mark Unread Flag Message From: To: Subject: Date: Apr 23, 2009 6:10 PM ‹ Previous | Next › | « Back to INBOX © 2008 EarthLink, Inc. All Rights Reserved. Members and visitors to the EarthLink Web site agree to abide by our Policies and Agreements EarthLink Privacy Policy Web Mail version 6.0.32
What am I doing wrong?
Thanks.
-- tom
Comment