I need to extract just the word out of the following examples:
/jeans/
/jeans
I'm able to extract the word when there is a backslash on both sides but need help figuring out how to write it so that if there's only 1 back slash it also returns just the word.
Here's what i'm using to remove the word when there's a backslash on either side of it:
LEFT(
MID([Website],
FIND([Website],"/")+1),
FIND(MID([Website],FIND([Website],"/")+1),"/")-1)
Can anyone help point me in the direction of how to get the word out regardless of whether there is a backslash on both ends of the word or just a backslash at the front?
Hi Tim,
Thanks for bringing a fun problem to the forums! I have created a calculated field that will remove any slashes from a string as long as the slashes are at the beginning or end of the string. Here is the calculated field itself:
IF (LEFT([Text],1) = '/' AND RIGHT([Text],1) = '/')
THEN LEFT(RIGHT([Text], (LEN([Text]) -1)), (LEN([Text]) -2))
ELSEIF (LEFT([Text],1) = '/' AND RIGHT([Text],1) != '/')
THEN RIGHT([Text], (LEN([Text]) -1))
ELSEIF (LEFT([Text],1) != '/' AND RIGHT([Text],1) = '/')
THEN LEFT([Text], (LEN([Text]) -1))
ELSE [Text]
END
Here it is in action:
I've also attached the .twbx in case you need to play around with it.
If you need any part of the calculation explained just let me know. Hope this helps you!
Regards,
Felix