From 823d27afa9906e99c4d511d0b7b3ca5659e36440 Mon Sep 17 00:00:00 2001 From: The-Lum <86879521+The-Lum@users.noreply.github.com> Date: Mon, 24 Jul 2023 14:24:35 +0000 Subject: [PATCH] fix: `ord` builtin function: retrieve then cast of the value By this indication: - https://github.com/plantuml/plantuml/pull/1487#issuecomment-1646545778 Fix `ord` builtin function: - retrieve then cast of the value --- src/net/sourceforge/plantuml/tim/stdlib/Ord.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/net/sourceforge/plantuml/tim/stdlib/Ord.java b/src/net/sourceforge/plantuml/tim/stdlib/Ord.java index 181a00310..d45bf6d62 100644 --- a/src/net/sourceforge/plantuml/tim/stdlib/Ord.java +++ b/src/net/sourceforge/plantuml/tim/stdlib/Ord.java @@ -59,7 +59,8 @@ public class Ord extends SimpleReturnFunction { public TValue executeReturnFunction(TContext context, TMemory memory, LineLocation location, List values, Map named) throws EaterException, EaterExceptionLocated { try { - final int value = (int) values.get(0).toString(); + final char firstChar = values.get(0).toString().charAt(0); + final int value = (int) firstChar; return TValue.fromInt(value); } catch (Throwable t) { return TValue.fromInt(0);