J
Jonathan
Hi, I'm having the hardest time finding how to do this on here and in
the books I've looked at so far.
How can I simply return a value for a function?
I want to try something like this (a function to replace certain
elements in a string), but I can't figure out how to return the final
product:
Function replaceit(somestring)
resultstring = Replace(somestring,"_","")
return resultstring '<------- this is one thing I tried
End Function
If I then take a string (say mystring, with a value of
'some_characters'), then I thought I could apply the following to it:
mynewstring = replaceit(mystring)
And end up with a new value of "somecharacters".
The reason I want to be able to do this with a function rather than
directly on each string is to avoid having to type in multiple
replacement codes for each string I want to replace.
Can someone tell me what I'm doing (or not doing) wrong?
Thanks
the books I've looked at so far.
How can I simply return a value for a function?
I want to try something like this (a function to replace certain
elements in a string), but I can't figure out how to return the final
product:
Function replaceit(somestring)
resultstring = Replace(somestring,"_","")
return resultstring '<------- this is one thing I tried
End Function
If I then take a string (say mystring, with a value of
'some_characters'), then I thought I could apply the following to it:
mynewstring = replaceit(mystring)
And end up with a new value of "somecharacters".
The reason I want to be able to do this with a function rather than
directly on each string is to avoid having to type in multiple
replacement codes for each string I want to replace.
Can someone tell me what I'm doing (or not doing) wrong?
Thanks