Manipulating a long text with AS3
Hi,
I'm loading a long text from my server to my AIR app.
The text is a weather forecast.
It's presenting like that :
"Today forecast is this one. This morning : the sun will be generous everywhere. This afternoon : clouds will hide the sun. This night : rain will fall. Tomorrow morning : blblablblabla"
I'd like to create multiple strings of each "section". A morning string section, an afternoon string section, a night string section..etc
If we take my morning string for example : how can I delete everything before "This morning" and everything from "this afternoon" (in order to only have, in my morning string : "This morning : the sun will be generous everywhere.")
So, if I'm correct, I've managed to select from "This morning" by doing that :
var str: String = "Today forecast is this one. This morning : the sun will be generous everywhere. This afternoon : clouds will hide the sun. This night : rain will fall. Tomorrow morning : blblablblabla";
var search_morning_starts: Number = str.indexOf("This");
var morning_str:String = str.substring(search_morning_starts,str.length);
trace(morning_str);
But how can I add to delete everything from "this afternoon" ? (can't say "delete everything after "everywhere" because the word "everywhere" won't be written every time. It depends on the weather of the morning. So I need to delete everything when "this afternoon"appears)
Thanks