bash message partial match

C++
if [[ $string == *"foo"* ]]; then
  echo "It's there!"
fistring="My string"
if [ $string ?? 'foo' ]; then
  echo "It's there!"
fi

Source

Also in C++: