From 09c27b3ebe905a48aafb07fa0e9d619f50e8cead Mon Sep 17 00:00:00 2001 From: Ryu Yamada Date: Thu, 12 Sep 2024 15:40:07 +0900 Subject: [PATCH] pass 1082 --- toukibo/stock_converter.go | 7 ++++++- toukibo/stock_converter_test.go | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/toukibo/stock_converter.go b/toukibo/stock_converter.go index 439ecb6..288220c 100644 --- a/toukibo/stock_converter.go +++ b/toukibo/stock_converter.go @@ -1,10 +1,15 @@ package toukibo -import "strings" +import ( + "strings" +) func StockToNumber(stock string) int { // 発行済株式の総数5万株 → 50000 stock = strings.Replace(stock, "発行済株式の総数", "", -1) + if strings.HasPrefix(stock, "普通株式") { // sample1082用のハック + stock = strings.Replace(stock, "普通株式", "", -1) + } stock = ZenkakuToHankaku(stock) sums := 0 diff --git a/toukibo/stock_converter_test.go b/toukibo/stock_converter_test.go index d7db612..40271ef 100644 --- a/toukibo/stock_converter_test.go +++ b/toukibo/stock_converter_test.go @@ -15,6 +15,11 @@ func TestStockToNumber(t *testing.T) { input: "発行済株式の総数5万株", expected: 50000, }, + { + // sample1082 + input: "発行済株式の総数普通株式     5138株A種優先株式   1250株B種優先株式   3250株", + expected: 5138, + }, } for _, tc := range testCases {