constexpr std::string ReplaceAllCopy(const std::string& x, const std::string& y, const std::string& z) {
auto x2 = x;
size_t i = 0;
while (true) {
i = x2.find(y, i);
if (i == std::string::npos) break;
x2.replace(i, y.length(), z);
}
return x2;
}
auto x2 = x.replace(y,z);
character(len=:), allocatable :: x
character(len=:), allocatable :: x2
character(len=:), allocatable :: y,z
integer :: j, k
k=1
do
j = index(x(k:),y)
if (j==0) then
x2 = x2 // x(k:)
exit
end if
if (j>1) then
x2 = x2 // x(k:j+k-2)
end if
x2 = x2 // z
k = k + j + len(y) - 1
end do
x2 = x.replace(y, z)
constexpr std::string ReplaceAllCopy(const std::string& x, const std::string& y, const std::string& z) { auto x2 = x; size_t i = 0; while (true) { i = x2.find(y, i); if (i == std::string::npos) break; x2.replace(i, y.length(), z); } return x2; }
std::stringstream s; std::regex_replace(std::ostreambuf_iterator<char>(s), x.begin(), x.end(), y, z); auto x2 = s.str()
string x2 = x.Replace(y, z, StringComparison.Ordinal);
auto x2 = x.replace(y,z);
var x2 = x.replaceAll(y, z);
x2 = String.replace(x, y, z)
X2 = binary:replace(X, Y, Z, [global]).
character(len=:), allocatable :: x character(len=:), allocatable :: x2 character(len=:), allocatable :: y,z integer :: j, k k=1 do j = index(x(k:),y) if (j==0) then x2 = x2 // x(k:) exit end if if (j>1) then x2 = x2 // x(k:j+k-2) end if x2 = x2 // z k = k + j + len(y) - 1 end do
x2 := strings.ReplaceAll(x, y, z)
x2 := strings.Replace(x, y, z, -1)
allchanged [] _ _ = [] allchanged input from to = if isPrefixOf from input then to ++ allchanged (drop (length from) input) from to else head input : allchanged (tail input) from to x2 = allchanged x y z
var x2 = x.replace(new RegExp(y, 'g'), z);
const x2 = x.replaceAll(y, z);
String x2 = x.replace(y, z);
x2 = x:gsub(y,z)
$x2 = str_replace($y, $z, $x);
x2 := StringReplace(x, y, z, [rfReplaceAll]);
my $x2 = $x =~ s/\Q$y/$z/gr;
x2 = x.gsub(y, z)
let x2 = x.replace(&y, &z);
Dim x2 As String = x.Replace(y, z, StringComparison.Ordinal)