mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-19 03:13:40 +00:00
Add a new predicate that tests if string contains any characters that succeed
for a given test predicate.
library/string.m:
Add the new predicate.
compiler/options.m:
Replace the predicate string_contains_whitespace/1 defined here
with a call to the new library predicate.
NEWS:
Announce the new predicate.
tests/hard_coded/Mmakefile:
tests/hard_coded/string_contains_match.{m,exp}:
Add a test of the new predicate.
10 lines
561 B
Plaintext
10 lines
561 B
Plaintext
contains_match(is_whitespace, "") ==> false.
|
|
contains_match(is_whitespace, "abc") ==> false.
|
|
contains_match(is_whitespace, " abc") ==> true.
|
|
contains_match(is_whitespace, "a bc") ==> true.
|
|
contains_match(is_whitespace, "abc ") ==> true.
|
|
contains_match(is_whitespace, "μῆνιν ἄειδε θεὰ Πηληϊάδεω Ἀχιλῆος") ==> true.
|
|
contains_match(is_chess_piece, "♜ ♞ ♝ ♛ ♚ ♝ ♞ ♜") ==> true.
|
|
contains_match(is_chess_piece, "abc♜ def") ==> true.
|
|
contains_match(is_chess_piece, "no chess pieces here!") ==> false.
|