The plantuml documentation for built-in functions can be found at https://plantuml.com/preprocessing
There is no reference to a built-in function %replacestr.
The closest fit would be a combination of %substr, %strpos and %strlen.
I was able to create the following

with
@startuml
!function pos(substring,wholeString)
!$result = 0
!if (%strlen(wholeString) == 0)
! return $result
!endif
!if (%strlen(substring) == 0)
! return $result
!endif
!$result=%strpos(wholeString,substring)+1
!return $result
!endfunction
!function copy(source,startingindex, count);
!$result = ""
!$index=startingindex
!if (startingindex < 1)
!startingindex=1
!endif
!if (count>%strlen(source))
!count=%strlen(source)
!endif
!if (%strlen(source) == 0)
!return $result
!endif
!$result=%substr(source,startingindex - 1,count)
!return $result
!endfunction
!function minusOne(n)
!$result = n - 1
!return $result
!endfunction
!function stringReplaceOnce(sourceString, oldPattern, newPattern)
!if (%strlen(sourceString) == 0)
! return sourceString
!endif
!if (%strlen(oldPattern) == 0)
! return sourceString
!endif
!if (pos(oldPattern,sourceString) == 0)
! return sourceString
!endif
!return copy(sourceString, 1, pos(oldPattern,sourceString) - 1)+ newPattern + copy(sourceString,pos(oldPattern,sourceString) + %strlen(oldPattern),%strlen(sourceString) - (pos(oldPattern,sourceString) + %strlen(oldPattern)) + 1)
!endfunction
!function replacestr(sourceString, oldPattern, newPattern)
!if (%strlen(sourceString) == 0)
! return sourceString
!endif
!if (%strlen(oldPattern) == 0)
! return sourceString
!endif
!if (pos(oldPattern,sourceString) == 0)
! return sourceString
!endif
!$result=sourceString
!$index=0
!while $index<50
!if (pos(oldPattern,$result) == 0)
!return $result
!else
!$result=stringReplaceOnce($result, oldPattern, newPattern)
!endif
!$index=$index+1
!endwhile
!return $result
!endfunction
note as Results
"replacestr" of ("ABXYABAB", "AB", "abc") produces : replacestr("ABXYABAB", "AB", "abc")
correct answer is : abcXYabcabc
end note
@enduml
Dick Maley