Remove quote marks from text
Hi all, having some troubles figuring out how to get a calculation working.
Basically I've created a field which users will paste a file directory path into, which will then be used to create a hyperlink which when emailed out to the user, they can click it and be taken straight to the directory pasted. I have that part of it figured out, but I'm wanting to try make it a little bit more robust.
Depending on how you copy a directory path, it can sometimes include " marks at the start or end, as an example, "\\internalserver\userdata\data\myaccount\Documents" . If those quotes get included in the hyperlink, it breaks.
Problem is, I cant even remove one of the quotes, let alone both. I've tried
which obviously didnt work, and neither did either
Anybody else have any ideas?
Its not the end of the world if it cant be done, I'll just add helper text to the field asking they make sure they remove any quotes. Or I could maybe check for a / character or the drive letter people will be copying, and just assume its quotes at the front if it's anything else, but I feel like thats prone to breakage as well.
I believe you have used TextArea as this introduces HTML for whatever user typed in.
Maybe you can use just a standard Text field or ExternalLink instead? And if that would not help in calculation, I would use standard Text Field and custom object with regexp which would prevent adding anything except hyperlinks or at least reject quotes.
@JordanG, you can try something like below. I haven't validated the calculation but it checks to see if there's a beginning double-quote and then checks to see if there a closing double-quote and if so, grab the text in-between, otherwise just get the text after the first double-quote. You'd have to add a check to see if there is no beginning double-quote and only a closings double-quote.
IF( FIND(""",[Text Field])>0, IF( FIND(""", [Text Field], LEN([Text Field])-2) >0, SUBSTRING([Text Field],2, LEN([Text Field]-1), SUBSTRING([Text Field],2, LEN([Text Field]) ), [Text Field] )
Yeah I did notice if I had a text area it would put quotes around whatever I put in. But even with a text field, depending how someone copies the file path, windows introduces "" around the path. If you Shift+Right Click a file in the file explorer, theres a menu item called Copy as Path, and that copies with the quotes.
I may have to have a look at that regexp in a custom object which you're talking about.
So I did try to give this a shot
IF( FIND(""",[Link Test])>0, IF( FIND(""", [Link Test], LEN([Link Test])-2) >0, SUBSTRING([Link Test],2, LEN([Link Test]-1)), SUBSTRING([Link Test],2, LEN([Link Test])) ), [Link Test] )
But that just gives an error due to the 3 double quotes. If I remove the quote or put another character in the find, it works, with the quote character it gives me a syntax error.