fixed loss of decimal point in stock prices

This commit is contained in:
skiesel 2019-06-13 10:25:17 -04:00
parent d1f11edf62
commit 48c395b026
1 changed files with 3 additions and 3 deletions

View File

@ -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)