943,163 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 363
  • VB.NET RSS
Jan 31st, 2010
0

Nested Tokens ?

Expand Post »
Hi,

I would like to use nested tokens, a similar question was asked in this thread

http://www.daniweb.com/forums/thread110255.html

While this did address how to do it with a single instance, I was wondering how to do it with multiple instances in a string. ie.

input to textbox1
"I {love|like} {blue|red|orange|pink} its my {favorite|worst} color "

press a button and would output a random word in the brackets to textbox2/msgbox similar to.

"I like red its my favorite color"
or
"I love pink its my worst color"

If someone could give me example code or point me in the right direction it would be much appreciated.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
pablo989 is offline Offline
3 posts
since Jan 2010
Jan 31st, 2010
0
Re: Nested Tokens ?
>point me in the right direction.

Regular Expression (Regex class)

VB.NET Syntax (Toggle Plain Text)
  1. Dim str = "I {love|like} {blue|red|orange|pink} its my {favorite|worst} color "
  2. str = Regex.Replace(str, "(\{|\})", "")
  3. str = Regex.Replace(str, "((\w+)+\|)", "")
  4. Console.WriteLine(str)
Moderator
Reputation Points: 2136
Solved Threads: 1228
Posting Genius
adatapost is offline Offline
6,525 posts
since Oct 2008
Jan 31st, 2010
0
Re: Nested Tokens ?
Cool, thankyou for your response.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
pablo989 is offline Offline
3 posts
since Jan 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: vb.net string variable skip a line
Next Thread in VB.NET Forum Timeline: Help how can I put the drive letter & user account name into a directory?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC