收藏
回答

两个字符串完全一样,判断却不相等

两个字符串完全一样,判断却不相等


console.log("==========================onShow()");

var sectionText = that.data.sectionText;

var sectionText2 = that.data.sectionText2;

console.log(sectionText.constructor); console.log(sectionText2.constructor);

console.log("that.data.sectionText=" + that.data.sectionText);

console.log("that.data.sectionText2=" + that.data.sectionText2);

console.log("that.data.sectionText.length=" + that.data.sectionText.length);

console.log("that.data.sectionText2.length=" + that.data.sectionText2.length);

console.log("that.data.sectionText != that.data.sectionText2=" + that.data.sectionText.trim() != that.data.sectionText2.trim());

console.log("that.data.sectionText == that.data.sectionText2=" + that.data.sectionText == that.data.sectionText2);

console.log("sectionText != sectionText2=" + sectionText != sectionText2);

console.log("encodeURIComponent(sectionText)=" + encodeURIComponent(sectionText));

console.log("encodeURIComponent(sectionText2)=" + encodeURIComponent(sectionText2));

console.log("encodeURIComponent(sectionText) == encodeURIComponent(sectionText2)=" + encodeURIComponent(sectionText) == encodeURIComponent(sectionText2));



house.js? [sm]:113 ==========================onShow()

house.js? [sm]:116 ƒ String() { [native code] }

house.js? [sm]:116 ƒ String() { [native code] }

house.js? [sm]:117 that.data.sectionText=碧桂园

house.js? [sm]:118 that.data.sectionText2=碧桂园

house.js? [sm]:119 that.data.sectionText.length=3

house.js? [sm]:120 that.data.sectionText2.length=3

house.js? [sm]:121 true

house.js? [sm]:122 false

house.js? [sm]:123 true

house.js? [sm]:124 encodeURIComponent(sectionText)=%E7%A2%A7%E6%A1%82%E5%9B%AD

house.js? [sm]:125 encodeURIComponent(sectionText2)=%E7%A2%A7%E6%A1%82%E5%9B%AD

house.js? [sm]:126 false

house.js? [sm]:130 true


回答关注问题邀请回答
收藏

2 个回答

  • A佳成
    A佳成
    2018-07-10

    换成逗号怎么连接呢

    2018-07-10
    有用
    回复 3
    • 谢欢
      谢欢
      2018-07-10

      逗号链接啊console.log('名字',name)  这样

      2018-07-10
      回复
    • A佳成
      A佳成
      2018-07-10

      还是不相等

      },onShow:function(){

      console.log("==========================onShow()");

      var sectionText = new String(that.data.sectionText);

      var sectionText2 = new String(that.data.sectionText2);

      console.log(sectionText.constructor); console.log(sectionText2.constructor);

      console.log("that.data.sectionText=",that.data.sectionText);

      console.log('that.data.sectionText2', that.data.sectionText2)

      console.log("that.data.sectionText.length=================",that.data.sectionText.length);

      console.log("that.data.sectionText2.length==================",that.data.sectionText2.length);

      console.log("sectionText 不等于 sectionText2=",sectionText != sectionText2);



      ==========================onShow()

      house.js? [sm]:116 ƒ String() { [native code] }

      house.js? [sm]:116 ƒ String() { [native code] }

      house.js? [sm]:117 that.data.sectionText= 碧桂园

      house.js? [sm]:118 that.data.sectionText2 碧桂园

      house.js? [sm]:119 that.data.sectionText.length================= 3

      house.js? [sm]:120 that.data.sectionText2.length================== 3

      house.js? [sm]:121 sectionText 不等于 sectionText2= true


      2018-07-10
      回复
    • 谢欢
      谢欢
      2018-07-12回复A佳成

      不应该啊.....

      2018-07-12
      回复
  • 谢欢
    谢欢
    2018-07-10

    你把中间的加号换成逗号试试


    2018-07-10
    有用
    回复 4
    • 陈
      2018-07-10

      你用equals试一下,许愿启明星的指引

      2018-07-10
      回复
    • A佳成
      A佳成
      2018-07-10

      js没有equals方法

      2018-07-10
      回复
    • 谢欢
      谢欢
      2018-07-10回复

      那个不能evl

      2018-07-10
      回复
    • A佳成
      A佳成
      2018-07-10

      感谢,兄弟,可以了,估计用加号成为连接符了

      2018-07-10
      回复
登录 后发表内容