please what the following statements mean??

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sara ali alali
    New Member
    • Aug 2010
    • 4

    please what the following statements mean??

    foreach (char c in textBox1.Text)
    bits += Convert.ToStrin g((int)c,2).Pad Left(8, '0');
  • Christian Binder
    Recognized Expert New Member
    • Jan 2008
    • 218

    #2
    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.ToStrin g((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.ToStrin g()
    String.PadLeft( )

    Comment

    • sara ali alali
      New Member
      • Aug 2010
      • 4

      #3
      thank you for your reply

      Comment

      Working...