Many ways to do this. Here's one.
ASCIIcode = blobtomatrix(chartoblob("1"),"int",1,"big")[1]; // 49
intermediate=blobtomatrix(chartoblob("0101111001010"),"int",1,"big")==ASCIIcode;
// intermediate=[0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0]
sum(intermediate);
Line 1 is just a way to get the ASCII code for the ASCII character "1", returned in a matrix of 1 element.
Line 2 is similar, but gets a bigger array and compares it to the desired code, resulting in the value in the Line 3 comment.
Line 4 just adds up the elements.
Craige