Bert,

Just a quick correction - the list of delimiters is a set of delimiter
characters - it itself is not comma delimited... 
(no need to either as each item is a single char)

so your code below would also count all commas in the mystring...

HTH,
Noam

        ----------
        From:  Bert Dawson [SMTP:[EMAIL PROTECTED]]
        Sent:  Thursday, 10 May 2001 12:01
        To:  Fusebox
        Subject:  RE: Slightly OT question ...

        Better way would be to use a comma delimited list of delimiters - i
forgot
        you could have more than one:

        <cfset mydelimiters = chr(13) & "," & chr(10)>

        No. of lines = #ListLen(mystring, mydelimiters)#

        > -----Original Message-----
        > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
        > Sent: 09 May 2001 21:42
        > To: Fusebox
        > Subject: RE: Slightly OT question ...
        > 
        > 
        > 
        > Hi Bert,
        > 
        >      I just wanted to say thanks for the information.  It was 
        > the bit of
        > code I was looking for to fix my problem.
        > 
        > 
        > Cheers
        > 
        > Ryan Williams
        > 
        > 
        > 
        >                                                               
        >                                                      
        >                     Bert Dawson                               
        >                                                      
        >                     <bdawson@redb        To:     Fusebox 
        > <[EMAIL PROTECTED]>                               
        >                     anner.com>           cc:                  
        >                                                      
        >                                          Subject:     RE: 
        > Slightly OT question ...                                 
        >                     05/09/01                                  
        >                                                      
        >                     12:48 PM                                  
        >                                                      
        >                     Please                                    
        >                                                      
        >                     respond to                                
        >                                                      
        >                     fusebox                                   
        >                                                      
        >                                                               
        >                                                      
        >                                                               
        >                                                      
        > 
        > 
        > 
        > You could use ListLen(yourstring,delimiter) where the 
        > delimiter is a "hard
        > return" - not sure whether you'll need to look for chr(10) or 
        > chr(13), or
        > both:
        > 
        > <cfset mystring = "line 1" & chr(10)
        >                                           & "line 2" & chr(10)
        >                                           & "line 3" & chr(13)
        >                                           & "line 4" & chr(10)
        >                                           & "line 5" & chr(13)
        >                                           & "the end">
        > 
        > <cfset chr10 = ListLen(mystring, chr(10))>
        > <cfset chr13 = ListLen(mystring, chr(13))>
        > 
        > <pre>
        > <cfoutput>
        > #mystring#
        > 
        > Number of chr(10) = #chr10#
        > Number of chr(13) = #chr13#
        > No of lines = #Evaluate(chr10 + chr13 - 1)#
        > </cfoutput>
        > </pre>
        > 
        > 
        > HTH
        > 
        > Bert
        > 
        > > -----Original Message-----
        > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
        > > Sent: 09 May 2001 16:57
        > > To: Fusebox
        > > Subject: Slightly OT question ...
        > >
        > >
        > > I would like to know if any of the string functions in 
        > Coldfusion can
        > > detect and/or count the number of hard returns inside of a
        > > text string.
        >
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to