enough that I could probably live with it, if I had too.
But as you know, we programmer types can spend too much time trying for
perfection. The only problem (that, again, I could probably live with) is
if there where a pipe "|" character in the string being processed. This
would result in an extra record, since the list functions would read one
list element as two. In and of itself, not really that big deal. But,
there are users who view this data I'm inserting in an old fashioned VT102
applications. They see each record on one line, so the broken up line may
look incorrect to them.
Now, my gut feeling is that there is probably less then a one percent chance
that the type of users who would be entering the string would use a pipe, so
this my not be worth exploring. But it would be nice, if this could be put
into an array or structure.
This is what I have come up with, but I would love to know if this could be
simplified.
<cfscript>
start = 1;
LFsubStr = "now is the time for all good men to come to the aid of their
country.";
while (start LT len(LFsubStr))
{
// yes, 2 ofs to make the space the 15th
sLastSpace = REFind('.{' & start & ',' & start+13 & '}(\s)', LFsubStr, 1,
1);
if (arraylen(sLastSpace.Pos) EQ 2)
{
subString = mid(LFsubStr,start,sLastSpace.Pos[2]-start);
start = sLastSpace.Pos[2];
}
else
{
substring = right(LFsubStr,len(LFsubStr)-start);
start = len(LFsubStr);
}
subStringAry[element] = subString;
element = element + 1;
}
</cfscript>
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]

