找回密码
 立即注册
查看: 6543|回复: 85

[脚本] 判断从网上接收的前后字符串长度是否相同

[复制链接]
发表于 2013-3-17 14:00 | 显示全部楼层 |阅读模式
c#

  1.     string tempStr1 = "";
  2.     string tempStr2 = "";
  3.     bool isSameStr = false;




  4.     IEnumerator GetNetMethod()
  5.     {
  6.             WWWForm form = new WWWForm();
  7.             form.AddField("post_username", strUser);
  8.             WWW www = new WWW(strReadAll, form);
  9.             yield return www;
  10.           if(isSameStr==false)//第一次执行保持数据
  11.           {
  12.               tempStr1 = www.text.ToString();
  13.               textList.Clear();
  14.               textList.Add(www.text.ToString());
  15.               isSameStr=true;
  16.           }
  17.           else
  18.           {
  19.               tempStr2=www.text.ToString();//以后数据的保持方式
  20.           }
  21.             if (isInsertting == false)
  22.             {
  23.                 if (textList != null)
  24.                 {
  25.                    if (tempStr2.Length >tempStr1.Length)
  26.                     {
  27.                         textList.Clear();
  28.                         textList.Add(www.text.ToString());
  29.                         tempStr1=tempStr2;//如果改变 则改变str1
  30.                     }
  31.                     else
  32.                     {
  33.                         print("length is same");
  34.                     }
  35.                    // print("textList Length is:" + lbl.text.ToString().Length.ToString());
  36.                    print("tempStr1 Length is:" + tempStr1.Length.ToString());
  37.                    print("tempStr2 Length is:" + tempStr2.Length.ToString());
  38.                     //  textList.a
  39.                 }
  40.             }
  41.             else
  42.             {
  43.                 print("running ");
  44.             }
  45.     }
复制代码
发表于 2017-3-16 19:08 | 显示全部楼层
真心顶
发表于 2017-3-16 18:39 | 显示全部楼层
难得一见的好帖
发表于 2017-3-16 18:42 | 显示全部楼层
很好哦
发表于 2017-3-16 18:50 | 显示全部楼层
不错不错
发表于 2017-3-16 18:34 | 显示全部楼层
LZ真是人才
发表于 2017-3-31 21:48 | 显示全部楼层
很不错
发表于 2017-3-31 22:11 | 显示全部楼层
顶顶多好
发表于 2017-3-31 21:52 | 显示全部楼层
说的非常好
发表于 2017-3-31 21:54 | 显示全部楼层
很好哦
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Unity开发者联盟 ( 粤ICP备20003399号 )

GMT+8, 2024-4-30 13:46 , Processed in 0.142274 second(s), 26 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表