diff --git a/k-distribution/include/kframework/builtin/domains.md b/k-distribution/include/kframework/builtin/domains.md index 85d55b4ff99..474ea6f8b1e 100644 --- a/k-distribution/include/kframework/builtin/domains.md +++ b/k-distribution/include/kframework/builtin/domains.md @@ -1881,11 +1881,15 @@ of the above operations in K. requires findString(Source, ToReplace, 0) substrString(Source, 0, findString(Source, ToReplace, 0)) +String Replacement +String replace(substrString(Source, findString(Source, ToReplace, 0) +Int lengthString(ToReplace), lengthString(Source)), ToReplace, Replacement, Count -Int 1) - requires Count >Int 0 - rule replace(Source:String, _, _, 0) => Source + requires Count >Int 0 andBool findString(Source, ToReplace, 0) >=Int 0 + rule replace(Source:String, _, _, Count) => Source + requires Count >=Int 0 [owise] rule replaceAll(Source:String, ToReplace:String, Replacement:String) => replace(Source, ToReplace, Replacement, countAllOccurrences(Source, ToReplace)) endmodule