mirror of
https://github.com/ArvinLovegood/go-stock.git
synced 2025-07-19 00:00:09 +08:00
- 新增 SearchGuShiTongStockInfo函数,用于爬取百度股市通的股票资讯 - 修改 OpenAI_API 函数,增加股市通资讯的爬取 - 添加 RemoveAllNonDigitChar 函数,用于去除所有非数字字符
24 lines
597 B
Go
24 lines
597 B
Go
package data
|
|
|
|
import "regexp"
|
|
|
|
// @Author spark
|
|
// @Date 2025/2/13 13:08
|
|
// @Desc
|
|
//-----------------------------------------------------------------------------------
|
|
|
|
// RemoveAllBlankChar 使用正则表达式移除字符串中的空白字符
|
|
func RemoveAllBlankChar(s string) string {
|
|
return removeAllSpaces(s)
|
|
}
|
|
func removeAllSpaces(s string) string {
|
|
re := regexp.MustCompile(`\s`)
|
|
return re.ReplaceAllString(s, "")
|
|
}
|
|
|
|
// RemoveAllNonDigitChar 去除所有非数字字符
|
|
func RemoveAllNonDigitChar(s string) string {
|
|
re := regexp.MustCompile(`\D`)
|
|
return re.ReplaceAllString(s, "")
|
|
}
|