Stuck with replacesubstring

Hi All,

I am just stuck with simple problem.

I have a field and it consists the value as follows “a~b~c~d~e~f~g” something like that and it is a hidden field i am collecting all the above values from user selection.

i am displaying all values in different fields using @word. here i want to replace particular value in the hidden field.

Example: this the hidden field value: “a~b~c~d~e~f~g”

now i want to replace “g” with “h”. for this i am giving user a inputbox so that i can replace the inputbox value with old value. I am getting the handle of the hidden field and getting the positon also but unable to replace. here i am using script. Any ideas to implement this in script?

Regards

suman

Subject: Stuck with replacesubstring

Are the items unique? What happens if they are not?

You could use InStr to find the start location and then a second INstr staritng at the last location to find the end of the string marked by the “~”

Then it’s just a case of:

Left( orgStr, startpos) + NewSubString + Right( orgStr, Len(OrgStr) - endpos)))

(Check the Right as I never get that quite right)

Or you could use the split command to make an array and check each element to see if it matches and replace the particular element and then Implode it back together. (Probably the easier)