question...let's say you're looking to break at the space before the 25th character...but the string you're working with is greater than 50 characters...

what i'm getting at is...do you want a break at the space before each 25th char (25, 50, 75, etc)?

charlie

  ----- Original Message -----
  From: DURETTE, STEVEN J (AIT)
  To: CF-Talk
  Sent: Monday, December 01, 2003 11:19 AM
  Subject: RE: The Last Space.

  Ian,

  This code uses more than one line, but it does work.

  <cfset myString = "The quick brown fox jumped over a lazy dog.">
  <cfif right(left(myString, 25), 1) neq " ">
  <cfset useList = 25 - len(listLast(left(myString, 25), " "))>
  <cfelse>
  <cfset useList = 25>
  </cfif>

  <cfoutput>#useList#</cfoutput>

  Steve

  -----Original Message-----
  From: Ian Skinner [mailto:[EMAIL PROTECTED]
  Sent: Monday, December 01, 2003 1:03 PM
  To: CF-Talk
  Subject: The 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]

Reply via email to