By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,255 Members | 559 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,255 IT Pros & Developers. It's quick & easy.

please what the following statements mean??

P: 4
foreach (char c in textBox1.Text)
bits += Convert.ToString((int)c,2).PadLeft(8, '0');
Aug 21 '10 #1
Share this Question
Share on Google+
2 Replies

Expert 100+
P: 218
It means: take every character of the Text in the TextBox (foreach(char c in textBox1.Text)), take the integer-keycode ((int)c) of this character, convert it to binary string (Convert.ToString((int)c,2)), if this string is short than 8 digits, fill them up with 0's (...PadLeft(8,'0')) and append it to a string-variable called bits

References: Convert.ToString()
String.PadLeft()
Aug 23 '10 #2

P: 4
thank you for your reply
Aug 23 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.