Suppose I have a string “ABCD”
I want to replace the value D with something else
The value D is dynamic
Is there a way to replace D with the value without using .Replace function ?
The string can also be “ABCDDD” . In case I use .Replace D it will replace D from all index. Howwever our goal is the replace “D” only from index 3
Hey @Ritaman_Baral ,
Assign
myString = “ABCDDD”
Assign
replacement = “H”
Assign
modifiedString = myString.Substring(0, 3) + replacement + myString.Substring(4)
HAPPY AUTOMATION!!
lrtetala
(Lakshman Reddy)
January 17, 2024, 8:15am
4
Hi @Ritaman_Baral
Can you try the below
Input="ABCDDDD"
If(Input.Length > 3, Input.Substring(0, 3) & "X" & Input.Substring(4), Input)
Input="ABCD"
If(Input.Length > 3, Input.Substring(0, 3) & "X" & Input.Substring(4), Input)
Cheers!!
mkankatala
(Mahesh Kankatala)
January 17, 2024, 8:24am
5
Hi @Ritaman_Baral
Input="ABCD"
Message Box-> Input.Remove(3, 1).Insert(3, "X")
Input="ABCDDD"
Message Box-> If(Input.Length > 3, Input.Substring(0, 3) & "X" & Input.Substring(4), Input)
You can use any of the two syntaxes.
Hope it helps!!
system
(system)
Closed
January 20, 2024, 8:24am
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.