go-stock/backend/data/utils.go
spark 467bbd8923 refactor(data):重构数据爬取功能
- 新增 CrawlerApi 结构体和相关方法,实现通用的爬虫功能
- 优化了 openai_api 和 stock_data_api 中的爬虫逻辑
- 添加了 RemoveAllBlankChar函数,用于移除字符串中的空白字符
- 更新了前端 stock组件中的警告提示
2025-02-13 14:16:56 +08:00

18 lines
428 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, "")
}