Jump to content

Inserting a return BEFORE a specific character


Recommended Posts

I am looking for a way to do the following in JavaScript.

 

The client list provided has a column header of "DROPOFLOCATION" and the column's cells contain a child and sibling name contained in parentheses.

Example:

Dropofflocation

1089 E 77TH ST  (Child Name + Sibling Name)

7618 ABERDEEN AVE  (Child Name)

 

I am looking for a way to insert a paragraph return before the first parentheses, so (Child Name + Sibling Name) returns to the line below. This is how I would like it to appear.

 

1089 E 77TH ST

(Name one +  Sibling Name)

 

Any ideas on how to code this?

 

Link to comment
Share on other sites

My coworker came up with this solution:

 

if (Field("DROPOFFLOCATION").indexOf("(") > -1)

{

   return ReplaceSubstring(Field("DROPOFFLOCATION"),"(","<br>(");

}

 

return Field("DROPOFFLOCATION");

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.

Guest
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...