user233: I have got a String filled up with 0 and 1 and would like to get an Integer out of it:
String bitString = ""; 
int Number;
int tmp;

bitString = "";
  for (i=1;i<=10;i++)
  {
    tmp= analogRead (A0);
    bitString +=  tmp % 2;
    delay(50);
  }
// now bitString contains for example "10100110" 
// Number = bitstring to int <-------------
// In the end I want that the variable Number contains the integer 166


user1407: Check out strtoul()
It should work something like this:
unsigned long result = strtoul(bitstring.c_str(), NULL, 2);
Now you have a long variable which can be converted into an int if needed.

user337: If you only need the string for printing you can store value in an integer and then use the Serial.print(number,BIN) function to format the output as a binary value.  Appending integers to strings is a potentially costly operation both in performance and memory usage.
int Number = 0;
int tmp;

for (int i=9;i>=0;i--) {
  tmp = analogRead (A0);
  Number += (tmp % 2) << i;
  delay(50);
}
Serial.print(Number, BIN);


233: <p>I have got a String filled up with 0 and 1 and would like to get an Integer out of it:</p>

<pre><code>String bitString = ""; 
int Number;
int tmp;

bitString = "";
  for (i=1;i&lt;=10;i++)
  {
    tmp= analogRead (A0);
    bitString +=  tmp % 2;
    delay(50);
  }
// now bitString contains for example "10100110" 
// Number = bitstring to int &lt;-------------
// In the end I want that the variable Number contains the integer 166
</code></pre>
 1407: <p>Check out <code>strtoul()</code></p>

<p>It should work something like this:</p>

<p><code>unsigned long result = strtoul(bitstring.c_str(), NULL, 2);</code></p>

<p>Now you have a long variable which can be converted into an int if needed.</p>
 337: <p>If you only need the string for printing you can store value in an integer and then use the <a href="http://arduino.cc/en/Serial/Print">Serial.print(number,BIN)</a> function to format the output as a binary value.  Appending integers to strings is a potentially costly operation both in performance and memory usage.</p>

<pre><code>int Number = 0;
int tmp;

for (int i=9;i&gt;=0;i--) {
  tmp = analogRead (A0);
  Number += (tmp % 2) &lt;&lt; i;
  delay(50);
}
Serial.print(Number, BIN);
</code></pre>
