Extracting a number from within a text field 
Author Message
 Extracting a number from within a text field

I need to extract a number from within a field.  The problem that arises is
that the field will vary in length and that number will move within that
field.
ie. Serial2: Data opened at 12:00 and no value specified
ie. Serial3: User logged out form system at 23:48
How can I get the 12:00 or 23:48 from within those fields?


MxF



Fri, 24 Mar 2000 03:00:00 GMT  
 Extracting a number from within a text field

Quote:

> I need to extract a number from within a field.  The problem that
> arises is
> that the field will vary in length and that number will move within
> that
> field.
> ie. Serial2: Data opened at 12:00 and no value specified
> ie. Serial3: User logged out form system at 23:48
> How can I get the 12:00 or 23:48 from within those fields?


> MxF

I don't have time to give you actual code but maybe this will help you.
Parse the field's individual parts into an array, then check each of the
array pieces for the data you are looking for.

"Serial2: Data opened at 12:00 and no value specified"  would become:
"Serial2:", "Data", "opened", "at", "12:00", "and",
"no","value","specified"

If you need help with a parse routine or more specifics, just e-mail me.

--
- Shane Russell -
"Doing the impossible for the ungrateful."

remove the "no.spam." to send me E-Mail.
I appologize for the inconvenience but 20 to 30 spams
per day is too much to handle.



Fri, 24 Mar 2000 03:00:00 GMT  
 Extracting a number from within a text field


Subject: Re: Extracting a number from within a text field
Date: Mon, 06 Oct 1997 15:07:37 -0400

Matthew,
    Try this.  I just tested it with a plain text box, where MyString is
the text to search through, and MyOtherString is the extracted time.
This pulls out ALL numbers and the ":" character.  If there are other
numbers in the text it'll pull those out too.

For i = 1 To Len(MyString)
        Select Case Asc(Mid$(MyString, i, 1))
            Case 48 To 58
                   MyOtherString = MyOtherString & Mid$(MyString, i, 1)
        End Select
 Next

Quote:

>> I need to extract a number from within a field.  The problem that
>> arises is
>> that the field will vary in length and that number will move within
>> that
>> field.
>> ie. Serial2: Data opened at 12:00 and no value specified
>> ie. Serial3: User logged out form system at 23:48
>> How can I get the 12:00 or 23:48 from within those fields?


>> MxF



Fri, 24 Mar 2000 03:00:00 GMT  
 Extracting a number from within a text field


Subject: Extracting a number from within a text field
Date: Mon, 6 Oct 1997 13:37:35 -0400

I need to extract a number from within a field.  The problem that
arises is
that the field will vary in length and that number will move within that
field.
ie. Serial2: Data opened at 12:00 and no value specified
ie. Serial3: User logged out form system at 23:48
How can I get the 12:00 or 23:48 from within those fields?


MxF



Fri, 24 Mar 2000 03:00:00 GMT  
 Extracting a number from within a text field


Subject: Re: Extracting a number from within a text field
Date: Mon, 06 Oct 1997 12:54:20 -0500

Quote:

>> I need to extract a number from within a field.  The problem that
>> arises is
>> that the field will vary in length and that number will move within
>> that
>> field.
>> ie. Serial2: Data opened at 12:00 and no value specified
>> ie. Serial3: User logged out form system at 23:48
>> How can I get the 12:00 or 23:48 from within those fields?


>> MxF

I don't have time to give you actual code but maybe this will help you.
Parse the field's individual parts into an array, then check each of the
array pieces for the data you are looking for.

"Serial2: Data opened at 12:00 and no value specified"  would become:
"Serial2:", "Data", "opened", "at", "12:00", "and",
"no","value","specified"

If you need help with a parse routine or more specifics, just e-mail me.

--
- Shane Russell -
"Doing the impossible for the ungrateful."

remove the "no.spam." to send me E-Mail.
I appologize for the inconvenience but 20 to 30 spams
per day is too much to handle.



Fri, 24 Mar 2000 03:00:00 GMT  
 Extracting a number from within a text field

Try the Val function. I have used it like this, to change a string into
numbers (fnString2Number)

j = Len(str2convert): lngTemp = 0

While j > 0
    nSingle = Val(Mid(str2convert, j, 1))
    lngTemp = lngTemp + nSingle
    j = j - 1
Wend

fnSTR2NUMBER = lngTemp

Eric



| I need to extract a number from within a field.  The problem that arises
is
| that the field will vary in length and that number will move within that
| field.
| ie. Serial2: Data opened at 12:00 and no value specified
| ie. Serial3: User logged out form system at 23:48
| How can I get the 12:00 or 23:48 from within those fields?
|

|
| MxF
|
|
|



Sat, 25 Mar 2000 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Extracting Text Within a Resource File

2. Extract only number from a text

3. Convert number field to text field.

4. Concatenating a Text Field and a Number Field

5. Extracting alpha text from a field

6. Wildcards finding long numbers within text .

7. Parse first number within text

8. Count number of strings within text

9. set text form field properties within a macro

10. Exporting a 3 decimal number to text file produces trunc 2 decimal text number

11. Reading a field and using that field to place a number in another field

12. Filter A Report From a Pop-Up Box for Text, Numbers, and Yes/No Field Types

 

 
Powered by phpBB® Forum Software