I am new to confluence and user macros.
I have managed to create a simple user script as follows -
## @noparams
$content.getIdAsString()
Which works fine and returns the page id.
However I want to extend the functionality here to only return the last x characters in the string.
How would I do this?
I tried the below and it gave me what I wanted.
## @noparams
$content.getIdAsString().substring(4)
Hopefully this helps somebody else also.
Thanks to Danyal for the tip.
$content.getIdAsString().split()
#Velocity is just a façade for real Java objects, so you have access to all the public methods of the String
class, including indexOf
and substring
.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thanks for taking the time to respond.
I have no experience in Java, so am googling everything I am trying here (I found the code above after a bunch of googling also.)
Will also google this Velocity stuff and hopefully figure out how to manipulate the string to return what I want.
Any tips?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.