Welcome Guest, Not a member yet? Register   Sign In
Extract text from MEDIUM TEXT
#3

[eluser]drewbee[/eluser]
Hmm strange my reply didn't take.

Anyways, I will type it out again.

Personally... I would use explode to handle this.

1. Explode string to array (seperate by spaces);
2. Loop over array until array value ('deadlines') is found, obtain key.
3. (2nd loop) Unset all values from the array whos key < deadlineKey - 10 and key > deadlineKey + 10.
4. Implode array (seperate by spaces)

This will result in a string containing 10 words before and after the word deadline.

Please note you will have to do some checking to insure after doing the math that you are not trying to unset any values < 0 (first word) and any values greater then count(array) (last word), otherwise errors will be thrown!


Messages In This Thread
Extract text from MEDIUM TEXT - by El Forum - 08-08-2008, 05:16 AM
Extract text from MEDIUM TEXT - by El Forum - 08-08-2008, 07:05 AM
Extract text from MEDIUM TEXT - by El Forum - 08-08-2008, 07:13 AM
Extract text from MEDIUM TEXT - by El Forum - 08-08-2008, 07:35 AM
Extract text from MEDIUM TEXT - by El Forum - 08-08-2008, 08:03 AM



Theme © iAndrew 2016 - Forum software by © MyBB