意外的字符串总和

时间:2014-02-18 15:07:12

标签: c# string windows-phone output

我有当前代码:

  http_server.Text = "5.79.16.127‏‏‏";

  http_port.Text = "8180";

  http_dimensione.Text = "3000000";

  http_ripetizioni.Text = "1";

  String static_link = "/autotestsuite/test/download.test?size=";

  String dimensione = http_dimensione.Text;  

  String ripetizioni = http_ripetizioni.Text;

  ripetizioni_number = Convert.ToInt32(ripetizioni);

  String durata = http_durata.Text;

  String server = http_server.Text;

  String port = http_port.Text;

  url = "http://" + server +":"+ port + static_link + dimensione;

  Debug.WriteLine("url "+url);

现在你期望在调试输出中看到什么? 我无法理解,因为我得到了这个:

 I GET THIS OUTPUT
 url http://5.79.16.127‏‏‏:8180/autotestsuite/test/download.test?size=3000000

我本来希望得到这个输出:

 I EXPECT THIS OUTPUT
 url http://5.79.16.127:8180/autotestsuite/test/download.test?size=3000000

1 个答案:

答案 0 :(得分:3)

我试过了:

String server_copied = "5.79.16.127‏‏‏";
foreach(var a in server_copied .ToCharArray())
{
    Console.WriteLine("{0} U+{1:x4} {2}", a, (int)a, (int)a);
}

String server_typed = "5.79.16.127";
foreach(var a in server_typed.ToCharArray())
{
    Console.WriteLine("{0} U+{1:x4} {2}", a, (int)a, (int)a);
}

在此问题中,server_copied分号后面的所有文字都是从代码段中复制粘贴的。并且server_typed之后的同一部分是手动输入的。

我可以在7 U+0037 55 server_copied .ToCharArray()之后看到3个不可打印的字符。如果没有这些字符,字符串将按预期连接(//5.79.16.127:8180而不是//5.79.16.1278180:)。

打印字符的代码段及其ASCII编号来自http://geekswithblogs.net