Replacing character in array

Array: {“testing”, “an apple”, “jelly”}
How do i replace e with a f in all items in the array, without using for loop?

Hi,

Can you try the following?

arrStr = {"testing", "an apple", "jelly"}
arrStr = arrStr.Select(Function(s) s.Replace("e","f")).ToArray()

Regards,

2 Likes

Hi am getting Option Strict On disallows late binding error

Hi,

Hi am getting Option Strict On disallows late binding error

Which type is your array?
It should be String[] in the above expression.

If you use object[], the expression will be the following.

arrStr.Select(Function(s) s.ToString.Replace("e","f")).ToArray()

Regards,

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