//yes, 2 ofs to make the space the 25th
string = "this is a test of of the emergency broadcast system. It is only a
test";
sLastSpace=REFind('.{1,24}( )', string, 1, 1);
if (arraylen(sLastSpace.Pos) EQ 2)
writeoutput(sLastSpace.Pos[2]);
</CFSCRIPT>
this says get 1 to 24 characters followed by a space. This space can be the 25th
character or earlier. It will capture the space location in the structure/array
returned.
sLastSpace.Pos[2] is the numeric location of that last space.
> Anybody know a trick (regex or otherwise) to find the position of the last
> white space character before an arbitrary limit?
>
> In the following example, I want the position of the last white space before
> the 25th character.
>
> "The quick brown fox jumped over a lazy dog."
>
> So I would want the position of the white space after 'fox', which is the
> 20th character. This is the last white space before the 25th character with
> is the 'e' in 'jumped'. Allowing me to break the string into:
>
> "The quick brown fox " <!-- note: trailing white space is included. -->
> "jumped over a lazy dog."
>
> I don't think this should be that hard, but for some reason, it has given me
> lots of trouble.
>
> Thanks
>
> --------------
> Ian Skinner
> Web Programmer
> BloodSource
> www.BloodSource.org
> Sacramento, CA
>
>
>
> Confidentiality Notice: This message including any
> attachments is for the sole use of the intended
> recipient(s) and may contain confidential and privileged
> information. Any unauthorized review, use, disclosure or
> distribution is prohibited. If you are not the
> intended recipient, please contact the sender and
> delete any copies of this message.
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

