split? how to use?

Results 1 to 2 of 2

Thread: split? how to use?

  1. #1
    fiios Guest

    Default split? how to use?

    say i got this string "1/2000"<BR>how to I get "31" and 2000"

  2. #2
    Join Date
    Dec 1969

    Default you wont

    You can&#039;t get a value that doesn&#039;t already exist in your string. Remember that the split function takes a string parameter. So, let&#039;s say you have a string like this. <BR>strPhrase = "every good boy does fine"<BR><BR>The great thing about the split function is that it creates the an array and you don&#039;t need to know beforehand how big the array will be. With the example above, you would do this.<BR><BR>strWords = Split(strPhrase, " ")<BR><BR>This will create an array and put every word into it&#039;s own position in the array because we specified the space as the delimiter. Now you can iterate through that array and print it all out like this.<BR><BR>for i = 0 to ubound(strWords)<BR>response.write strWords(i) & "<BR>"<BR>next<BR><BR>So, using your example before, you could create something like this.<BR><BR>datDate = "1/2000"<BR>strDate = Split(datDate, "/")<BR><BR>That would produce an array where strDate(0) = 1 and strDate(1) = 2000. Hope that helps to clear it up a bit.<BR>

Posting Permissions

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