how to split "www", "200" and "23feb" into one column each of them.
then, how to make sure this split process also occur at "www 303 24march" and so on..
yes.. thank you for reply,,
but, it only split at the first of the sentences...
how to make sure it also split at the next sentences also.. for example:
this is the text after uploaded to the system:
i want the split process also occur at www 303 24march, www 200 23feb and so on automtically after click the button. my system only split at the first sentences..
The you have to make a loop to parse them all. Something like this should parse them into a multidimensional array for you to access however you need to display.
Code:
var strings = new Array();
strings[0] = "www 200 23feb";
strings[1] = "www 303 24march";
strings[2] = "www 200 23feb";
strings[3] = "www 303 27march";
strings[4] = "www 200 21feb";
strings[5] = "www 303 29march";
for (i=0;i<=strings.length;i++)
{
results[i] = strings[i].split(" "); //Saves array in an array
}
__________________
jeremy - gnomeontherun Educated questions often get educated answers, and simple questions often get simple answers.
can u check my code?
at bold sentences have error and it says expecting semicolon before left bracket..
i dont know what to do?
through this code, is it split myText.text into several categories?
private function applicationCompleteHandler():void
{
var stringToSplit:String = myText.text; var result[i]:Array = stringToSplit[i].split(" ");
var Split:LogReader = new LogReader();
You are using an array index identifier that doesn't exist (i).
Code:
private function applicationCompleteHandler():void
{
var stringToSplit:String = myText.text;
var result:Array = stringToSplit.split(" ");
var Split:LogReader = new LogReader();
for (i=0;i<=result.length;i++)
{
Split.ip = result[0];
Split.date = result[3] + result[4];
Split.method = result[5];
Split.info = result[6] + result[7];
Split.url = result[8];
}
sourceArray.push(Split);
ac.refresh();
}
I guess I don't understand what you are trying to do, except that this code doesn't seem to make sense to me. I made another change in the for loop, because otherwise it won't run correctly (.length is for number of entries in an array here). What format is the data really coming in as (exactly) and what do you want it to sort into?
__________________
jeremy - gnomeontherun Educated questions often get educated answers, and simple questions often get simple answers.
usually the text is more longer than this..
the split divided only 5 categories:ip, date, method, info and url. that's why this code had been made:
var stringToSplit:String = myText.text;
var result:Array = stringToSplit.split(" ");
var Split:LogReader = new LogReader();
Split.ip = result[0];
Split.date = result[3] + result[4];
Split.method = result[5];
Split.info = result[6] + result[7];
Split.url = result[8];
and the package LogReader.as imported in the system made this process works.
my problem is how to make the split process also occur at the next ip address?
my coding only split at the first paragraph..
i want it split simultaneously at the whole paragraph at the text that had been uploaded into the system.
i hope my explanations is good enough to make u understand what is actually i am going to do..
i hope u can help me.
thank you.
So you are reading a log, that makes this more tricky. Honestly I would employ a few techniques rather than just splitting the string. You can search a string if it contains "POST" or "GET" for example, you could get the text between [] as the date, and search based on what is between " marks. It would be more labor intensive and require stronger code, but would be a much better way. What if someone has a URL with a space in it? You would have errors I think the current way.
__________________
jeremy - gnomeontherun Educated questions often get educated answers, and simple questions often get simple answers.
yes. but the other features will implemented after the split process works at the whole paragraph..
the system actually also planned to should be have check box option to make the analyzer more easier to analyze log.
as i told before, it works splitting at the first paragraph and it shows that split by space is not be the problem.. and let be my supervisor think it about if have space in the url because he asks me to do it like this. but, i will ask him later.
however, i have problem in how to make the splitting process also splitting at the second and so on paragraphs simultaneously with the first paragraph..
i had try this before:
for each(var line:String in myText.text.split("\n"))