From dd7dc703abce12111b01084650c05530b2b921b9 Mon Sep 17 00:00:00 2001 From: Jose Date: Fri, 16 Jun 2023 08:15:44 -0500 Subject: [PATCH] fix error when input value has max length --- instructingFI.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/instructingFI.go b/instructingFI.go index cfaa32c7..d7d3c1f9 100644 --- a/instructingFI.go +++ b/instructingFI.go @@ -51,7 +51,7 @@ func (ifi *InstructingFI) Parse(record string) error { ifi.FinancialInstitution.Identifier = value length += read - if len(ifi.FinancialInstitution.Identifier) >= 34 { + if len(ifi.FinancialInstitution.Identifier) >= 34 && record[length-1:length] != "*" { length += (strings.Index(record[length:], "*") + 1) } value, read, err = ifi.parseVariableStringField(record[length:], 35) @@ -61,7 +61,7 @@ func (ifi *InstructingFI) Parse(record string) error { ifi.FinancialInstitution.Name = value length += read - if len(ifi.FinancialInstitution.Name) >= 35 { + if len(ifi.FinancialInstitution.Name) >= 35 && record[length-1:length] != "*" { length += (strings.Index(record[length:], "*") + 1) } value, read, err = ifi.parseVariableStringField(record[length:], 35) @@ -71,7 +71,7 @@ func (ifi *InstructingFI) Parse(record string) error { ifi.FinancialInstitution.Address.AddressLineOne = value length += read - if len(ifi.FinancialInstitution.Address.AddressLineOne) >= 35 { + if len(ifi.FinancialInstitution.Address.AddressLineOne) >= 35 && record[length-1:length] != "*" { length += (strings.Index(record[length:], "*") + 1) } value, read, err = ifi.parseVariableStringField(record[length:], 35) @@ -81,7 +81,7 @@ func (ifi *InstructingFI) Parse(record string) error { ifi.FinancialInstitution.Address.AddressLineTwo = value length += read - if len(ifi.FinancialInstitution.Address.AddressLineTwo) >= 35 { + if len(ifi.FinancialInstitution.Address.AddressLineTwo) >= 35 && record[length-1:length] != "*" { length += (strings.Index(record[length:], "*") + 1) } value, read, err = ifi.parseVariableStringField(record[length:], 35)