Does Ruby have a some_string.starts_with(\"abc\") method that\'s built in?
some_string.starts_with(\"abc\")
You can use String =~ Regex. It returns position of full regex match in string.
String =~ Regex
irb> ("abc" =~ %r"abc") == 0 => true irb> ("aabc" =~ %r"abc") == 0 => false