ToUpperCases based on the original string
This works:
MapThread[If[EvenQ[#2], ToUpperCase[#1], #1] &, {Characters @ "05eccead24",
IntegerDigits @ FromDigits @ "1234567456"}] // StringJoin
(* "05eCcEaD24" *)
Edit: I first used StringReplacePart
but that function is slow when used for many replacements, much as MapAt
is. I have rewritten my code using a method from Map a function across a list conditionally and it is now orders of magnitude faster on long strings.
f[source_String, target_String] :=
Module[{new = Characters @ target},
(new[[#]] = ToUpperCase @ new[[#]]) & @
StringPosition[source, Characters @ "02468"][[All, 1]];
new <> ""
]
f["1234567456", "05eccead24"]
"05eCcEaD24"