How do I get a substring of an entity property in my design?

Avatar

Avatar
Level 1
MarlonNelson
Level 1

Likes

0 likes

Total Posts

2 posts

Correct reply

0 solutions
View profile

Avatar
Level 1
MarlonNelson
Level 1

Likes

0 likes

Total Posts

2 posts

Correct reply

0 solutions
View profile
MarlonNelson
Level 1

18-06-2021

I'm able to use the replace method on an entity property:

 

#set ($pageUrl = $entity1.pageUrl.replace(".com", ".org"))

 

I want to get a substring of the property also.  Specifically, I want to insert characters before a trailing slash.  I'm wanting to do something like this:

 

#set ($pageUrl = "$entity1.pageUrl.substring(0, $entity1.pageUrl.length()-1).new/")

 

Can this be done somehow?  If so, where's it documented?

Accepted Solutions (0)

Answers (1)

Answers (1)

Avatar

Avatar
Level 1
MarlonNelson
Level 1

Likes

0 likes

Total Posts

2 posts

Correct reply

0 solutions
View profile

Avatar
Level 1
MarlonNelson
Level 1

Likes

0 likes

Total Posts

2 posts

Correct reply

0 solutions
View profile
MarlonNelson
Level 1

18-06-2021

I'd probably need to add braces like this:

#set ($pageUrl = "${entity1.pageUrl.substring(0, $entity1.pageUrl.length()-1)}.new/")

Alternatively, something like this would be nice:

#set ($pageUrl = "$entity1.pageUrl.replaceAll('/$', '.new/')")