Re: Extracting a pattern of numbers from a text string



In article <s2clt1ttbo1ko17rf8415303f0gr3gfgoc@xxxxxxx>, Wes
<wchester@xxxxxxxxxxxxxxxx> wrote:

> I have a job database with job numbers entered into a text string
> field. My goal is to extract just the numbers out of this text string
> and put this into another field with the set step. I know the format
> of the numbers to extract, but the actual job numbers will be
> different. A job number looks like this: ##.####

If job numbers ALWAYS look like that (ie. two digits, dot, four digits)
then you can simply use the Left and Right functions to extract the
appropriate number of digits,
eg.
NumBeforeDot = Left(TextField, 2)

NumAfterDot = Right(TextField, 4)

These can be calculations in a Set Field script command or Calculation
fields (text or number result) or auto-enter Calculations for a Text /
Number field.


If the numbers can vary in length, but still ALWAYS have a dot in
between, then you'll have to use the Position function to find out
where the dot is and use that as a delimiter,
eg.

NumBeforeDot = Left(TextField, Position(TextField, ".", 1, 1) - 1)

NumAfterDot = Right(TextField, Length(TextField) -
Position(TextField, ".", 1, 1))



Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)
.



Relevant Pages

  • Re: extract numbers from string
    ... > a textbox contains numbers and characters ... how can I only extract the numbers from that field for some ... That depends on where the numbers are in the string. ...
    (microsoft.public.access.formscoding)
  • Re: Fastest way to look for an array of char?
    ... >> Surely you'll use the index some where down the line to extract a ... but I use the string for editing the actual string. ... The dot ... means any character. ...
    (comp.lang.php)
  • SystemVerilog: how to extract parts of a string
    ... If I have a string: ... and I want to extract the block_name from the string, ... I know there's a substr function ...
    (comp.lang.verilog)
  • Re: How do I pull the info from this PostScript?
    ... Do you just want to extract the title from a file, ... When anchorsearch returns true, the 'post' string ... SourceArrayDecode filter from the array, and cvx exec the filter. ...
    (comp.lang.postscript)
  • Re: Newbie: Array of pointers to strings questions.
    ... > What I'm trying to do is extract information from one file and insert ... The first file has a string of ... > char *ptr; ... line1 is just a constant pointer to a character. ...
    (comp.lang.c)

Loading