ByteVector b("Hello, world!"); if (b.startsWith("Hello")) { // ByteVector starts with "Hello" } else { // ByteVector does not start with "Hello" }
ByteVector b("0123456789ABCDEF"); if (b.startsWith(ByteVector::fromHex("01"))) { // ByteVector starts with "01" } else { // ByteVector does not start with "01" }
ByteVector b1("0123456789"); ByteVector b2("012"); if (b1.startsWith(b2)) { // b1 starts with b2 } else { // b1 does not start with b2 }This function is part of the Crypto++ package library.