Problems with built-in Functions %upper and %lower in Eclipse

0 votes
asked Dec 3, 2020 in Question / help by schmidtjano (220 points)


I am receiving an "Unknow [sic] built-in function" error when using the functions %upper() and %lower().

Oddly, Eclipse is properly generating diagrams which include several other % functions such as %date() as well as %strlen() and %substr(). 

The following example works perfectly using the PlantUML online server (see it here) but returns an error in Eclipse:

!$az = "Hello"
!$bz = %upper($az)

!function $bold($a) return "<b>" + $a + "</b>"
!function $lower($a) return %lower($a)

User -> Processor ++ #green : Submit variable value: $bold($az)
Processor -> Processor : Process request.
return Results:\nUpper Case is: $bold($bz), and\nLower Case is: $bold($lower($bz)).

FYI, I am using Eclipse IDE version 2020-09 (4.17.0), build ID 20200910-1200 running on Windows 10, v.10.0, x86_64 / win32 with Java version 13.0.2.

Any thoughts or tips would be much appreciated.

Many thanks in advance!


1 Answer

0 votes
answered Dec 3, 2020 by The-Lu (16,520 points)

Hello S.,

  • What is your PlantUML version on Eclipse?

Because, FYI, the 2 built-in functions (%upper/%lower) are only present from V1.2020.2 (1 Mar, 2020);
(See PR#296).

If that can help,

commented Dec 4, 2020 by schmidtjano (220 points)

Hello, Th. 

Many thanks for your prompt reply! Below is my version, which is, as you correctly suspected, not the 2020 version.  

PlantUML version 1.2019.11 (Sun Sep 22 05:02:15 CDT 2019)
(EPL source distribution)
Loaded from bundleresource://1436.fwk1150293741/

This is odd since I only started using PlantUML with Eclipse in October and downloaded from the recommended site Even checking for updates does not help. Am I doing something incorrectly, or is there another site from which I should be installing PlantUML for Eclipse? 

Many thanks in advance!


commented Jan 4 by schmidtjano (220 points)

Hello and Happy New Year!

My PlantUML version running in Eclipse is 1.2019.11 (Sun Sep 22 05:02:15 CDT 2019). So, apparently have to wait until the plug-in is updated.

I tried creating a work-around for the %upper as follows:


!function $upper($a)

!$len = %strlen($a)

!$pos = 0

!$z = ""

!while ($len-$pos) > 0 

!$x = %substr($a, $pos, 1)

!if $x == "a"

!$x = "A"

!elseif $x == "b"

!$x = "B"

!elseif $x == "c"

!$x = "C"

!elseif $x == "d"

!$x = "D"

!elseif $x == "e"

!$x = "E"

!elseif $x == "f"

!$x = "F"

!elseif $x == "g"

!$x = "G"

!elseif $x == "h"

!$x = "H"

!elseif $x == "i"

!$x = "I"

!elseif $x == "j"

!$x = "J"

!elseif $x == "k"

!$x = "K"

!elseif $x == "l"

!$x = "L"

!elseif $x == "m"

!$x = "M"

!elseif $x == "n"

!$x = "N"

!elseif $x == "o"

!$x = "O"

!elseif $x == "p"

!$x = "P"

!elseif $x == "q"

!$x = "Q"

!elseif $x == "r"

!$x = "R"

!elseif $x == "s"

!$x = "S"

!elseif $x == "t"

!$x = "T"

!elseif $x == "u"

!$x = "U"

!elseif $x == "v"

!$x = "V"

!elseif $x == "w"

!$x = "W"

!elseif $x == "x"

!$x = "X"

!elseif $x == "y"

!$x = "Y"

!elseif $x == "z"

!$x = "Z"


!if %substr("-" + $a, $pos, 2) == "\n"

!$x = "n"

John -> Sally : I found a "\n" at position $pos!


!$z = $z + $x

!$pos = $pos + 1 


!return $z


John -> Sally : $upper("hello")

John -> Sally : $upper("\hello")

John -> Sally : $upper("\nhello")

John -> Sally : $upper("a\nhello")

John -> Sally : $upper("ab\nhello")

Sally --> John : $upper("If music be the food of love, play on;\nGive me excess of it, that, surfeiting,\nThe appetite may sicken, and so die.")

John -> Sally : $upper("a1b2c3d4...z26")


This works perfectly with the online server but once again results in a parsing error in my Eclipse.

Any thoughts?