I see, what you want is a single integer whose bit patterns match this binary array? Probably the most efficient thing to do is to build up such an integer directly, rather than creating an array first. For example, the following works as long as the number of characters in the string is < 64:
function tobits(predicate::Function, s::String)
n = UInt64(0)
len = 0
for c in Iterators.reverse(s)
len += 1
len > 64 && throw(ArgumentError("length of string is > 64"))
n = (n << 1) + predicate(c)
end
return n
end
which gives
julia> n = tobits(c -> c in vowels, string)
0x0000000000000008
julia> bitstring(n)
"0000000000000000000000000000000000000000000000000000000000001000"
(I used Iterators.reverse so that bit i corresponds to character i+1, where i=0 is the least-significant bit.)