%substr(..., $variable) does not work if strings are added in the same line

0 votes
asked Nov 11, 2022 in Bug by kirchsth (4,980 points)

If the second argument of `%substr` is a variable, and it is used in a more complex context then it returns the whole string and not only the relevant part.

e.g. in following sample the gray text should be without customer

@startuml
legend
!$labelWithDetails = "Customer\nPeople that need products"
!$brPos = %strpos($labelWithDetails, "\n")
!$line = %substr($labelWithDetails, 0, $brPos) + " <color:gray>" + %substr($labelWithDetails, $brPos + 2) + "</color>"
$line
endlegend
@enduml

 

BR Helmut

1 Answer

0 votes
answered Nov 17, 2022 by plantuml (295,000 points)
selected Nov 17, 2022 by kirchsth
 
Best answer

Thanks for the report!

This should be fixed with last online version.

commented Nov 17, 2022 by kirchsth (4,980 points)
thank you for the fast fix
...