Since you're being pedantic my reply is going to be equally pedantic: no, this is not correct if you understand the difference between numerals and numbers.
A numeral is a written way of denoting a number. So while the string "IIIIIIII..." arguably contains a Roman numeral denoting the number 4 as a substring (if you accept "IIII" as a Roman numeral), it still does not contain the Roman numeral "IV" as a substring.
Or phrased differently, by your logic you might as well say that "IIIIIIII..." contains the Arabic numeral "4". It doesn't.
> > The function would return true for 'IIIIII' because it contains the Roman numeral 'IV'.
That's arguably correct. 'IIII' is a valid Roman numeral representation of 4 [1], and the string 'IIIIII' does contain 'IIII'.
[1] https://en.wikipedia.org/wiki/Roman_numerals#Other_additive_...