Extracting Characters from Harness Variable Expressions
You can return the character at a specified index in a Harness variable expression string.
This can be helpful with built-in variable expressions such as
<+artifact.image>, or variables that contain version numbers or other important strings.
To return characters, you can use the
charAt() method with your variable expression.
Step 1: Use the charAt() Method
Let's look at an example where you have a variable named
<+version>. that evaluates to
To get the first character of the string, you would use
<+<+version>.charAt(0)>. This would return
<+version> references the variable, and the rest of the expression evaluates the string using the