SPONSORS:






User Tag List

Results 1 to 6 of 6
  1. #1
    Senior Member
    Join Date
    Dec 2000
    Location
    Phoenix, AZ
    Posts
    371
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Get first item is LIST OF STRING

    I am wondering how I would go about finding the first item in a LIST OF STRING and storing this in a string variable for comparison.

    ------------------

  2. #2
    Member
    Join Date
    Jul 2002
    Location
    Chennai,TN,India
    Posts
    36
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Get first item is LIST OF STRING

    Initialise a Counter and track it.

    Like....

    [-] for each sListItem in sList
    [ ] iCount = iCount + 1
    [-] if iCount == 1
    [ ] sQuery = sListItem
    [-] else
    [ ] sQuery = sQuery + ","+sListItem
    [ ]


    ------------------
    Babu NM
    Babu NM

  3. #3
    Senior Member
    Join Date
    Dec 2000
    Location
    Phoenix, AZ
    Posts
    371
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Get first item is LIST OF STRING

    What I actually want to do is get the text of the first item, take a substring of it, and then compare the substring with another string.

    The problem I am having is getting the text of the first item.

    ------------------

  4. #4
    Senior Member
    Join Date
    Nov 1999
    Location
    Eagle, ID,USA
    Posts
    1,035
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Get first item is LIST OF STRING

    LIST OF STRING lsText = {"Item1","Item2"}
    print(lsText[1])

    prints "Item1"

    ------------------
    Have you ever noticed? Anybody going slower than you is an idiot, and anyone going faster than you is a maniac.

  5. #5
    Member
    Join Date
    Jul 2002
    Location
    Chennai,TN,India
    Posts
    36
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Get first item is LIST OF STRING

    If i am right,it does the same.

    Let us assume, the list of String has three items namely "one","two","three".You need take the text "one" and do some comparison.
    If this is ur requirment.Look at the explanation else skip the below statements and explain what u want?

    Initialise a counter as 0.

    Within for loop(for each sListItem in sList), increment the counter(iCount = iCount + 1) and if the counter value is 1 if iCount == 1, it points to Item1(i.e "One").Then get the item text by STRING sQuery = sListItem. Now sQuery should be "one".




    ------------------
    Babu NM
    Babu NM

  6. #6
    Senior Member
    Join Date
    Dec 2000
    Location
    Phoenix, AZ
    Posts
    371
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Get first item is LIST OF STRING

    Thanks. I think both of these examples will give me what I need.

    ------------------

 

 

Posting Permissions

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

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 02:22 AM.

Copyright BetaSoft Inc.