首次提交:初始化项目代码

This commit is contained in:
sunct
2026-07-31 15:18:32 +08:00
commit d6393266b0
193 changed files with 14287 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
package main
import (
"fmt"
"regexp"
)
func main() {
text := "A:99元,B:199元,积分:50"
// 捕获【数字+元】整体,分组单独取出数字
re := regexp.MustCompile(`(\d+)元`)
matches := re.FindAllStringSubmatch(text, -1)
var amountList []string
for _, item := range matches {
// item[0] = 99元,item[1] = 99 纯数字
amountList = append(amountList, item[1])
}
fmt.Println("仅提取金额数字:", amountList)
}