Receiving serial data to send to a shift register

Edit: after posting, I realized it may be better if I do the processing on my pc, and send a single byte instead of the pattern itself. I think I'll work on that. I'm still curious how I'd convert it if I had to in another scenario (i.e. reading 8 sensors, and then sending the data to the shift register to turn on LEDs if certain conditions are met)

I'm looking to receive a data via serial from my PC and then send that data to a shift register to light up 8 leds. I'm really new to this aspect, but I've been researching this online but now have come to a standstill.

For example, I want to send "s11100111" to my arduino through serial and have it send 111001111 to the shift register.

So far I've had luck on another project when I declare my pattern such as: byte pattern = {B11100111} but I'm unsure how to convert my incoming serial data into that.

Here's my code I have so far. It receives the data from serial and stores it in an array. Is there anything major I should change? How would I go about converting my array into something I could easily shiftOut (or should I be storing it different in the first place?) Thanks

void setup()
{

	Serial.begin(9600);
	
}





void loop()
{
	int serialpos = 0;
	int mybits[8];	


	while (Serial.available() > 8) {

		if (Serial.read() == 's') {

			Serial.println("Starting Sequence.");

			while (serialpos < 8) {
				mybits[serialpos] = Serial.read();
				serialpos++;
			}


			Serial.print("Sequence Received: ");
			for (int xloop = 0; xloop < 8;xloop++) {
				Serial.print(mybits[xloop],DEC);
			}
			Serial.println("");
			serialpos = 0;
			
			// *
			// Here is where I'm looking to convert the mybits array into something I can shiftOut
			//*
			
			
		}

	}



}

indytemple:
I want to send "s11100111" to my arduino through serial and have it send 111001111 to the shift register.

That seems easy enough. The way I'd do that is to read and buffer characters in a char array until you have received the whole message (using a newline to indicate the end of each message seems like the most obvious approach). Then process each character in the message to test whether it is '1' or '0' and save the result in your preferred binary output format. That would require a for loop to process each character, an if statement to test whether the character was a '1' or a '0' (or something else), and a call to bitWrite() to set the corresponding bit in your output data to 1 or 0. Once you have processed all eight bits you will have the result in a byte variable which you can use the same was as you have already done previously.

Thank you, Peter. BitWrite is exactly what I was looking for so I'm going to mess with it. I won't need it on this for right now (since I changed my process) but I'll be able to use that for another thing I'm working on.