From 6b57d036272eca227f45d14effa895542d3fac88 Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Wed, 8 Dec 2021 16:06:35 +0100 Subject: [PATCH] trim "" from strings before use --- lib/core/string.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/core/string.rb b/lib/core/string.rb index 74edb91..9c685f2 100644 --- a/lib/core/string.rb +++ b/lib/core/string.rb @@ -19,7 +19,7 @@ module Rpl def from_string( stack, dictionary ) stack, args = Rpl::Lang::Core.stack_extract( stack, [%i[string]] ) - parsed_input = Rpl::Lang::Parser.new.parse_input( args[0][:value] ) + parsed_input = Rpl::Lang::Parser.new.parse_input( args[0][:value][1..-2] ) stack += parsed_input @@ -42,7 +42,7 @@ module Rpl stack << { type: :numeric, base: 10, - value: args[0][:value].ord } + value: args[0][:value][1..-2].ord } [stack, dictionary] end @@ -53,7 +53,7 @@ module Rpl stack << { type: :numeric, base: 10, - value: args[0][:value].length } + value: args[0][:value][1..-2].length } [stack, dictionary] end @@ -64,7 +64,7 @@ module Rpl stack << { type: :numeric, base: 10, - value: args[1][:value].index( args[0][:value] ) } + value: args[1][:value][1..-2].index( args[0][:value][1..-2] ) } [stack, dictionary] end