Reputation: 1
The following string could be: dsafk$asdlfdl or odldl$ldlkfjdsljfdslkjfdslkjf
I need to do the following. Select everything to the rigt of the dollar sign, move it to the left of the dollar sign, and then put a second string that is coming into this function to the right of the dollar sign where the old string was.
Upvotes: 0
Views: 1070
Reputation: 30398
myString = myString.Replace("$", string.Empty) & "$" & passedString
Upvotes: 3
Reputation: 218867
There are a number of ways to do string manipulation. You'll want to add error checking and all that, but something like this should do the trick:
myString = string.Format("{0}{1}${2}", myString.Split("$")[0], myString.Split("$")[1], passedString)
or:
myString = string.Format("{0}${1}", myString.Replace("$", string.Empty), passedString)
and so on...
Upvotes: 2