SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: Shuffle words in string
-
Jan 20, 2014, 07:07 #1
- Join Date
- Jan 2014
- Posts
- 62
- 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
-
Jan 20, 2014, 07:22 #2
- Join Date
- Oct 2002
- Location
- Scotland
- Posts
- 3,631
- 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.
-
Jan 20, 2014, 10:07 #3
- Join Date
- Jan 2014
- Posts
- 62
- 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