Q:

How to find specific character in string without effecting original var

i have "id#a1-beAklA23A" i want to find first "A" only  after "-"  and replace it without too much code like  binding etc
I've tried :
    dim item = "id#a1-beAklA23A"
    dim id = item.Split("-"c)

    Dim regex = New Regex("A", RegexOptions.IgnoreCase)
    id = regex.Replace(id, "#", 1)

    console.WriteLine(id)

it gives me error that Replace can't  work with String() 'array' 
And my code will not work good because it will output stuff after "-" only and replace. and i need to bind back before "-" and after "-"
when i have alot of items it will not be practical 

A:

The error is because id is an array - of the strings generated by splitting item.
You can limit the number of parts returned by Split.
Dim item = "id#a1-beAklA23A"
Dim id = item.Split({"-"c}, 2)

Dim re = New Regex("A", RegexOptions.IgnoreCase)
Dim item2 = id(0) & "-" & re.Replace(id(1), "#", 1)

Console.WriteLine(item2)

