SitePoint Sponsor

User Tag List

Results 1 to 10 of 10

Hybrid View

  1. #1
    Get my greedy down dotJoon's Avatar
    Join Date
    Apr 2003
    Location
    daejeon, South Korea
    Posts
    2,223
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    output of one value in myList

    Code:
    <cfset myList="3,5,7,9">
    Let's suppose I have myList like the above.

    I like to output the 2nd value in myList.

    The following code is one of my trials for it, but I failed.

    Code:
    trial code
    
    <cfset myList="3,5,7,9">
    
    <cfoutput>
    #myList[2]#
    </cfoutput>
    
    target result
    
    5

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,350
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    come on, joon, you simply must try harder to find the appropriate functions for yourself

    did you forget the hundreds of threads where we taught you how to become self-sufficient in coldfusion?

    i'll give you a hint on this one

    go here: http://www.cfquickdocs.com/

    there are three dropdowns: Tag/Function, Tag Category, and Function Category:

    choose the Function Category and select List functions

    see if you can find a function that allows you to get at one of the list items
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Wizard aaron.martone's Avatar
    Join Date
    Feb 2003
    Location
    Florida, USA
    Posts
    2,322
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    <cfset lstNumbers = "1,3,5,7,9" />
    <cfoutput>#ListGetAt( VARIABLES.lstNumbers, 2 )#</cfoutput>

    This will output "3" to the screen, the 2nd index of the comma delimited list. If you have a list with a delimiter that is not a comma, ie:

    <cfset lstNumbers = "1|3|5|7|9" />

    you can use:

    #ListGetAt( VARIABLES.lstNumbers, 2, '|' )#

    to specify the custom delimiter.

    Also, what Rudy says is true beyond your wildest dreams. It's like the story of giving a man a fish (ie, just telling you the answer) vs. TEACHING a man to fish (ie, teaching you to use search engines or find the answer on your own)

    Easily enough you could have Google'd "ColdFusion List Functions" and would have gotten the ListGetAt with no problems.
    Last edited by aaron.martone; Nov 5, 2008 at 13:30.

  4. #4
    SitePoint Wizard aaron.martone's Avatar
    Join Date
    Feb 2003
    Location
    Florida, USA
    Posts
    2,322
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Also, the reason why you failed too is because a List is NOT an Array. ( Though CF provides a handy BIF (built-in function) called ListToArray()! ) When you say " Files[x]", that is Array notation, indicating the x element within the array.

    Lists don't have array elements, they have index positions (starting with 1). Drop $40, pickup The ColdFusion 8 Web Application Construction Kit Volume 1, and give it a read through. A GREAT piece of literature that will get you all the basic CF functions and then some.

    And when you're read, Volumes 2 and 3 are also well worth the money.

  5. #5
    Get my greedy down dotJoon's Avatar
    Join Date
    Apr 2003
    Location
    daejeon, South Korea
    Posts
    2,223
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Some years ago I bought BenForta's book of Cold Fusion. I faild in reading it due to my poor English.

    I don't know 'at the moment' where the book is.

  6. #6
    SitePoint Evangelist
    Join Date
    Mar 2007
    Posts
    584
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by joon View Post
    Some years ago I bought BenForta's book of Cold Fusion. I faild in reading it due to my poor English.

    I don't know 'at the moment' where the book is.
    You raise an interesting question. Does anyone know if there are versions of CFWACK (or even the basic documentation) in other languages?

  7. #7
    Get my greedy down dotJoon's Avatar
    Join Date
    Apr 2003
    Location
    daejeon, South Korea
    Posts
    2,223
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cfStarlight View Post
    Does anyone know if there are versions of CFWACK (or even the basic documentation) in other languages?
    No Korean CF documentation formally.

  8. #8
    SitePoint Wizard aaron.martone's Avatar
    Join Date
    Feb 2003
    Location
    Florida, USA
    Posts
    2,322
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Really? Your English sounds very good, IMO. You seem to type (speak?) it very fluently.

  9. #9
    SitePoint Evangelist
    Join Date
    Mar 2007
    Posts
    584
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by aaron.martone View Post
    Really? Your English sounds very good, IMO. You seem to type (speak?) it very fluently.
    Personally, I agree with you. But I am still curious about CF documentation in other languages.

  10. #10
    Get my greedy down dotJoon's Avatar
    Join Date
    Apr 2003
    Location
    daejeon, South Korea
    Posts
    2,223
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by aaron.martone View Post
    Really? Your English sounds very good, IMO. You seem to type (speak?) it very fluently.
    I usually give data in myTable first with some point colors.

    Can you guess why do I work hard(?) for making point colors and keeping the patterns?



    I need ColdFusion English here in this forum instead of real English.


    Hm ~, as I do actively question in this forum for the recent some years. I think I might become somewhat more fluent English posting maker than a fluent ColdFusioner. ( I learned English more than coldFusion from this forum as a result currently.)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •