Getting some chars from a string?

Jeff Massung massung at gmail.com
Tue Feb 9 14:19:05 EST 2010


On Tue, Feb 9, 2010 at 1:01 PM, Richmond Mathewson <
richmondmathewson at gmail.com> wrote:

> I have a series of image names for the type:
>
> f#.png
>
> where # can be a number anywhere between 1 and 6 figures long.
>
> what I need is to extract the number from the image name.
>
>
Try using a regular expression:

function extractImageNumber pName
   local tNumber

   if matchText(pName,"f(\d+)\.*", tNumber) is false then
      return empty
   end if

   return tNumber
end extractImageNumber

Jeff M.



More information about the use-livecode mailing list