gpt4 book ai didi

c# - 如何在字符串中搜索一个词,然后得到这个词后面的数字?

转载 作者:太空宇宙 更新时间:2023-11-03 20:21:23 24 4
gpt4 key购买 nike

喜欢:

"Name: Daniel --- Phone Number: 3128623432 --- Age: 12 --- Occupation: Student"

如何获取“Age”后面的内容?我只想要数字。 (他的年龄)

最佳答案

使用正则表达式:

^.+Age\: ([0-9]+).+$

第一次分组会返回年龄,见herehere .

关于c# - 如何在字符串中搜索一个词,然后得到这个词后面的数字?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13304451/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com