I need to get a text in a textbox and assign each letter of that text to a different variable.Anyone know how to do this?
6 Replies - 273 Views - Last Post: 17 July 2012 - 01:02 PM
#1
Assigning each leter in a textbox to a different variable
Posted 17 July 2012 - 12:45 PM
Replies To: Assigning each leter in a textbox to a different variable
#2
Re: Assigning each leter in a textbox to a different variable
Posted 17 July 2012 - 12:47 PM
What have you tried?
#3
Re: Assigning each leter in a textbox to a different variable
Posted 17 July 2012 - 12:53 PM
#4
Re: Assigning each leter in a textbox to a different variable
Posted 17 July 2012 - 12:57 PM
One thing you can play with is the idea that Strings have a method called "ToCharArray" which will take your string and put each character into a spot on an array. This will serve the purpose of each array spot being like a variable, plus it is easy to iterate, pull out single chars based on index and also gives you array properties like slicing etc.
http://msdn.microsof...y/ezftk57x.aspx
Won't need to create individual variables either.
http://msdn.microsof...y/ezftk57x.aspx
Won't need to create individual variables either.
#5
Re: Assigning each leter in a textbox to a different variable
Posted 17 July 2012 - 12:59 PM
Martyr2, on 17 July 2012 - 12:57 PM, said:
One thing you can play with is the idea that Strings have a method called "ToCharArray" which will take your string and put each character into a spot on an array. This will serve the purpose of each array spot being like a variable, plus it is easy to iterate, pull out single chars based on index and also gives you array properties like slicing etc.
http://msdn.microsof...y/ezftk57x.aspx
Won't need to create individual variables either.
http://msdn.microsof...y/ezftk57x.aspx
Won't need to create individual variables either.
Could you make a sample/example code please?
#6
Re: Assigning each leter in a textbox to a different variable
Posted 17 July 2012 - 01:00 PM
How about you go to the MSDN link there where there is an example? Come on now, I think you are smart enough to figure out what it means by saying a string is put into an array of single characters
This post has been edited by Martyr2: 17 July 2012 - 01:01 PM
#7
Re: Assigning each leter in a textbox to a different variable
Posted 17 July 2012 - 01:02 PM
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote







|