-
Notifications
You must be signed in to change notification settings - Fork 0
/
Test.as
43 lines (39 loc) · 920 Bytes
/
Test.as
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package
{
import flash.display.Sprite;
import utils.CSVParser;
/**
* ...
* @author lizhi
*/
public class Test extends Sprite
{
public function Test()
{
var csvdata:String = "id(key)(int),name(string),phone(string)\r\n" +
"0,jim,18600039143\r\n" +
"1,alex,1234567\r\n" +
"2,albert,688323\r\n" +
"3,gino,984343\r\n" +
"4,hunk,677676"
;
var parser:CSVParser = new CSVParser(csvdata);
trace("line data of id == 1");
traceobj(parser.getDataLine(1));
trace()
trace("name of id==2");
trace(parser.getData(2,"name"));
trace()
trace("line data of phone == 984343");
traceobj(parser.searchDataLine("phone",984343));
trace()
trace("id of name==hunk");
trace(parser.searchData("name","hunk","id"));
}
private function traceobj(obj:Object):void {
for (var str:* in obj) {
trace(str,obj[str])
}
}
}
}