[2005] Replace String

danasegarane

Active member
Joined
Jun 14, 2006
Messages
41
Programming Experience
Beginner
Replace String

Dear All,
I have two array of text string array1 and array2.Now I need to replace the contents of the array2
with array1.If the array2 contains the arraylist then leave.Else add the items to the array2.How can I


For example

String1="1;2;3;4;5"
String2="3:5"

I want to check for string2 in string1.If it contains then that matching items to be removed from
the first string

Thanks in Advance
Dana
 
Last edited by a moderator:
Dana,

If you are using VS 2005, please adjust your profile in the User CP to set your primary platform appropriately. No need to put [2005] in the subject line.

Thank you.
 
Dear All,
I have two array of text string array1 and array2.Now I need to replace the contents of the array2
with array1.If the array2 contains the arraylist then leave.Else add the items to the array2.

What has array, arraylist, string array and leaving, got to do with the following?:

String1="1;2;3;4;5"
String2="3:5"

I want to check for string2 in string1

Please try to be more specific when asking a question:

Do you mean you want to search string1 for the presence of 3 and then later search it for the presence of 5, removing any found entries

Or do you mean you want to search string1 for the presence of 3:5 and remove any found entries?
 
Anyway,

You can solve this with the split function. Like:

Dim sArray as string()
Dim sItem as string

String1="1;2;3;4;5"
String2="3:5"
sArray=String2.split(":")

for each sItem in sArray
if instr(String1,sItem)<>0 then
... yes, it's in there
else
... no, it's not there
end if
next
 
Back
Top