Replace function for System.Array

jviper

Member
Joined
Nov 24, 2005
Messages
12
Programming Experience
1-3
Hello. as you may know the Strings class has a Replace function which is designed to replace all of a charactor/string that exists in a string you specify. What I want is a similar function that for example takes an array of integers, searches the array for an integer value I specify, and replaces all of them with that integer. Problem is, looping through all of the items in the array is too slow. Is there a way to do this without having to loop through the entire array?
 
Use the Array.IndexOf property to search an array

intResult = Array.IndexOf(YourArray, ValueToFind)

If intResult >= 0 then

YourArray(IntResult) = NewValue

End If
 
Back
Top