I need to have the following : (name1 + "a") + (name2 + "a") + ...
Dim separator() As String = {"|"}
myString.Split(separator, StringSplitOptions.None).SomeLinq(...)
I don't know what to add at the end to add an "a" to each element...
I need to have the following : (name1 + "a") + (name2 + "a") + ...
Dim separator() As String = {"|"}
myString.Split(separator, StringSplitOptions.None).SomeLinq(...)
I don't know what to add at the end to add an "a" to each element...
User StringBuilder and foreach()
EDIT: OOps, I don't know VB.NET, only C#, so use whatever the equivalent is of foreach
Use Select
in this case:
Dim separator() As String = {"|"}
myString.Split(separator, StringSplitOptions.None).Select(Function(s) (s + "a"))
Select
can be used as a "conversion" function this way, too. After this, you can convert back to your one string:
String.Join("|", myString.Split(separator, StringSplitOptions.None).Select(Function(s) (s + "a")).ToArray())
My apologies if the VB.Net is slightly off; I'm a C# developer, typically.