2010-11-22 30 views
0

我有以下问题,Autocad DXF文件中的字符串与我的AS3文件中的字符串没有比较,即使它们完全相同。DXF字符串比较

作为简单的例子

private function onComplete():void 
{ 
    myTextLoader.load(new URLRequest("Drawing1.dxf")); 
    myTextLoader.addEventListener(Event.COMPLETE, onLoaded);     
} 

private function onLoaded(e:Event):void { 

myArrayOfLines = e.target.data.split(/\n/); 

for(var i:uint=0;i<=myArrayOfLines.length-2;i++) 
{ 
    GetLineCouple(i); 
    if(line1 == "0" && line2 == "LINE")//comparison does not work here 
{ 
    //Any code 
} 
} 

//to remove whitespaces 
public function stripspaces(originalstring:String):String 
{ 
    var original:Array=originalstring.split(" "); 
    return(original.join("")); 
} 

private function GetLineCouple (index:uint):void  
{ 
    line1 = stripspaces(myArrayOfLines[index]); 
    line2 = stripspaces(myArrayOfLines[index+1]); 
} 

预先感谢。

+2

您可能想详细说明一下更多... – Ben 2010-11-22 22:05:26

回答

0

不是在下一行删除连字符,而现在一切正常

公共职能stripspaces(originalstring:字符串):字符串 { 回报originalstring.replace(/ \ s + /克, “”); }