如何从Web API返回的字符串中获取值?

huangapple go评论74阅读模式
英文:

How to get the value from a string that returns from a Web API?

问题

如何获取refno、status和deldate的值?

英文:

I have a string that returns from a Web API:

example:

 string res = "refno=11111&status=0&deldate=2023-07-16"

how to get the value of refno, status and deldate?

答案1

得分: 1

这被称为“查询字符串”。 如果您不想自己解析字符串,可以使用 HttpUtility.ParseQueryString 来获取其中的部分。

链接:https://learn.microsoft.com/en-us/dotnet/api/system.web.httputility.parsequerystring?view=net-7.0

英文:

That's called a "query string". You can use HttpUtility.ParseQueryString to get the pieces, if you don't want to parse the string yourself.

https://learn.microsoft.com/en-us/dotnet/api/system.web.httputility.parsequerystring?view=net-7.0

huangapple
  • 本文由 发表于 2023年7月6日 11:21:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/76625281.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定