【问题标题】:Remove Commas from my textfield从我的文本字段中删除逗号
【发布时间】:2013-11-18 09:54:07
【问题描述】:

将 XML 中的元素插入文本字段时遇到问题。

当我跟踪我的代码时,我得到的所有元素都没有任何逗号,但是当我将它插入文本字段时,我得到了很多逗号。

我尝试拆分文本以删除逗号,但 XML 中没有任何逗号,我该怎么做?

这是我的代码

var B:Array = [];
var textLength:int = imgData.Vehicle.EquipmentList.children().length();
var list:XMLList = imgData.Vehicle.EquipmentList.children();
var equipmentList:XMLList = list.text();
for(var t = 0; t < textLength; t++)
{

    var equipText:String = list[t];
    equipText.split(",");
    B.push(equipText);
    trace(equipText);
    //B = B.split(", ").join();
}

errorMessage.text = B.toString();

【问题讨论】:

    标签: xml actionscript-3 split textfield


    【解决方案1】:

    逗号由 toString() 方法添加。 见http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Array.html#toString()

    你应该使用 join() 方法。

    errorMessage.text = B.join("");
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-02-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-14
      • 2023-02-25
      相关资源
      最近更新 更多