From 48c395b026e3990348f43a07e8504ce12a478b15 Mon Sep 17 00:00:00 2001 From: skiesel Date: Thu, 13 Jun 2019 10:25:17 -0400 Subject: [PATCH] fixed loss of decimal point in stock prices --- plugins/stock/stock.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/stock/stock.go b/plugins/stock/stock.go index e85fdab..f2c8ba8 100644 --- a/plugins/stock/stock.go +++ b/plugins/stock/stock.go @@ -69,10 +69,10 @@ func (p *StockPlugin) message(c bot.Connector, kind bot.Kind, message msg.Messag response := "Failed to retrieve data for stock symbol: " + tokens[1] - cleaned := strings.ReplaceAll(string(body), " ", "") - regex := regexp.MustCompile("[0-9][0-9]\\.") + regex := regexp.MustCompile("[0-9][0-9]\\. ") - cleaned = regex.ReplaceAllString(cleaned, "") + cleaned := regex.ReplaceAllString(string(body), "") + cleaned = strings.ReplaceAll(cleaned, " ", "") var info GlobalQuote err = json.Unmarshal([]byte(cleaned), &info)