SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2014
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Shuffle words in string

    Hi Guys

    Is there any easy way to shuffle the words/phrases in a string? The words/phrases in my string are separated by commas so an example of data within my string is something like this:

    "electric mirrors, alloys, power assisted steering, quattro, spoiler, 8-way stereo speaker"

    I need to shuffle the keywords/phrases so it would look like this:

    "alloys, electric mirrors, 8-way stereo speaker, quattro, power assisted steering, spoiler"

    I need to do this n classis asp.

    Any ideas how I can do this? Any help would be fully appreciated

    Best regards

    Rod from the UK

  2. #2
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,629
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Shuffling words is not that much of an issue. The key though is in determining HOW they are to be shuffled (i.e. what result is desired). If they are to be sorted alphabetically then that is quite easy, but if the sort order depends on the content then this can become very difficult to work.

    In terms of doing the shuffling, look at the Split() and Join() methods in VBScript, and the related Array handling methods.
    Ian Anderson
    www.siteguru.co.uk

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2014
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Site Guru

    Thanks so much for your response

    I just want the keywords/phrases to be ordered randomly.

    I have looked at various VBScript methods but I am unable to find any that "randomly" orders the keywords/phrases.

    Any help would be fully appreciated

    I look forward to hearing from you

    Best regards

    Rod from the UK


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
  •