"+" sign in front of positive number

Is there a way to add a “+” sign in front of a value displayed in a text label when the number is positive?
I have a bunch of modifiers displayed in a module and it would look better to have a “+” along with the “-” in front of the modifiers.

I forgot to add that they are calculated values so I can’t just put a “+” sign in the label.

Assuming you’re displaying the contents of a property called “X”, you could set your text label to {(X >= 0 ? "+" | "") + X} . This will check if X is greater than or equal to 0 (you could change that to just “>” if you don’t want “0” to have a plus in front of it), and if so, display a “+” (if not, display an empty string), then add the actual contents of X at the end.

Technically, text labels aren’t supposed to support Beanshell expressions, so if that gives you any problems, you could instead create a Calculated Property (e.g., “DisplayX”) with the expression (X >= 0 ? “+” | “”) + X, then set the text label display to $DisplayX$.

I’m sure there are also other ways to do this.


When it’s hard-coded like in the prompt list of a Dynamic Property you can use → {"+1"}. It will then display the + correctly in a text label.


I’m a pretty basic user, haven’t done all that fancy coding :slight_smile:
What I have is pretty simple:

Calculated Property: “AttackBonus” = (attack-defense)
Text Label: $AttackBonus$

I tried plugging the formula above (replacing “X” ) into a calculated Property with no success.