摘要:
class HttpSQSClient { private String server, port, charset; public HttpSQSClient(String server, String port, String charset) { this.server = server; this.port = port; this.charset = charset; } private string DoProcess(String urls... 阅读全文
摘要:
执行下面一段代码时,捕捉到异常:ProtocolViolationException HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); request.Method = "get"; byte[] requestBytes = System.Text.Encoding.UTF8.GetBytes(data); request.ContentType = "application/x-www-form-urlencoded... 阅读全文
摘要:
一行包含汉字、字母、数字的文本,如:string txt = "一段C#代码值123元,你能接收吗?"; 如果我想把数字123截出来,直接使用txt.substring(12,3),实际截出的是“你能接”。所以可以考虑先转化为字节后再截取,代码如下: public class StringUtil { static string SubstringByte(string txt, int start, int length, string charset) { Encoding enc = Encoding.GetEncoding(... 阅读全文