From 5804a6a74d1659647f29ca58050bce6bcf3c232b Mon Sep 17 00:00:00 2001 From: Deepi Garg <48362243+deepigarg@users.noreply.github.com> Date: Sat, 28 Mar 2020 20:03:19 +0530 Subject: [PATCH] Added insert function --- lib/parfait/word.rb | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/lib/parfait/word.rb b/lib/parfait/word.rb index f9ea7e25..39b01bf6 100644 --- a/lib/parfait/word.rb +++ b/lib/parfait/word.rb @@ -189,6 +189,32 @@ module Parfait def padded_length Object.padded( 4 * get_type().instance_length + @char_length ) end + + def insert(index, other) + if index<0 + index = self.length()+1+index + end + cpy = Word.new( self.length()+other.length() ) + cpy_ind=0 + str_ind=0 + while ( str_ind