Find and replace character in string

Hi Everyone.

I have extracted and got a string as below:

value = -0.A382

I want to check the 3rd character of this string… if the 3rd character is “A”, then it will replace by “B”… output string : “-0.B382”

I have tried this but not correct : value.Substring(3)=“A”

Thanks you!

1 Like

Try this Value [3]

4 Likes

sorry…how to change ?

@trunghai

Is there any chance A will be in other position ?

If not then try below expression.

         inputStr = "-0.A382"
         newStr = inputStr.Replace("A","B")
5 Likes

Thanks you bro.

I have found the solution by this code :

value.Substring(3,1)

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.