flash - How to search for specific words and values in a long string? -


ok objective is:

1.read in text file. e.g containing text this, teacher/student/1/sn/2/3/4/5/9/f/tn/02/

2.pass string.

3.then beable extract different parts of string , place them in different arrays.

the bit dont know how extracting specific parts of string? possible search / , treat comes after specific peice of information until next / read?

or perhaps there more efficient approach?

help , advice sought

kindest regards adrian

if strings have separator, can split them:

var string:string = "teacher/student/1/sn/2/3/4/5/9/f/tn/02/"; var parts:array = string.split("/"); // ["teacher", "student", ...] 

to search specific words, regexp might good:

var re:regexp = /teacher|student/; var match:object = re.exec(string); //match[0] = "teacher" 

of course, check out docs.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -