[英]counting actual characters in a URI encoded string
在客戶端上,我有一個textarea,我像這樣提取它的值:
var TheURIEncodedString = encodeURI($('#TheTextArea').val());
字符串如下所示:
"This%20is%20a%20test%0AThis%20is%20a%20new%20line"
我通過ajax發送此字符串,當我在服務器上收到該字符串時,我需要計算實際字符數,而不是字符串的長度。
我怎樣才能做到這一點?
HttpUtility.UrlDecode("This%20is%20a%20test%0AThis%20is%20a%20new%20line").Length;
結果:
This is a test
This is a new line
int numberOfCharacters =
HttpUtility.UrlDecode("This%20is%20a%20test%0AThis%20is%20a%20new%20line").Length;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.