Jump to content

Trimming data


Recommended Posts

edit. I figured it out in different way. Still not sure how a TRIM function would work properly though?


Instead of:



It would be:


Basically getting rid of the http:/


Here is the code I came-up with that worked.

var s = Field("Personalized URLs");
s = ReplaceSubstring(s, "http:/", "");
return s;



Edited by rpaterick
Link to comment
Share on other sites

Assuming you want to eliminate everything before "www." I think it may be a better solution to use a regex to get rid of it. Especially considering most websites start with "http://" the code that you wrote would return a string starting with a "/".


The following code will replace all patterns starting with a series of letters ending with a ":" followed by one or more "/" to handle addresses that start with "http:/" , "http://", "https://", "ftp://", etc.


var s = "http://www.Ryans.MyPrePassBenefits.com";
return s.replace(/(\w+:\/+)/,"");

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...