2010-11-22 27 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 + /克, 「」); }