I am doing a HTTP request on WebAPI, and I am getting response of ID.
The response is: |10123087-0|||
I need to save only the first eight digits without the ||
and the |-0|
. How can this be done?
You can use action, that takes a string value as parameter
Example
Your JSON request:
{'message' : '|10123087-0|||'}
Your action
public ActionResult MyAction(string message)
{
// You can also use regular expressions
var result = message.Replace("-0|||", "").Replace('|', '');
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.