From 3ad6cdb7f6c3c6a678e7f34383aaac941d0df95c Mon Sep 17 00:00:00 2001 From: Milan Date: Wed, 13 Sep 2023 10:17:37 -0400 Subject: [PATCH] avoid invalid string index with prevind, findlast --- src/utility_functions.jl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utility_functions.jl b/src/utility_functions.jl index 8fa12de92..e65a0b9af 100644 --- a/src/utility_functions.jl +++ b/src/utility_functions.jl @@ -94,6 +94,9 @@ function print_fields(io::IO,A,keys;arrays::Bool=false) s *= "$key, " end end - print(io,s[1:end-2]) # remove last ", " + + # remove last ", " + s_without_comma = s[1:prevind(s,findlast(==(','), s))] + print(io,s_without_comma) end end \ No newline at end of file