Top index Wirbel home

::part_match

string.part_match(int, string) - check if string contains substring at a certain position
string.part_match(int i, char achar) - check if string contains character at certain position

string.part_match(int, string) checks, if a string contains a substring at a certain position. No copy of any string is made in order to perform this test. This is faster than first extracting a substring of the first string and then matching it against the other. The empty string matches at all positions, even at the position after the laster character.

string.part_match(int i, char achar) is a variant that exists for polymorphic programming and handles the case, that the substring to be checked is given as single character.

Examples

"hello-world".part_match(6, "wor") == true
"abcde".part_match(5, "")          == true
"hello.htm".part_match(6, "html")  == false