Split sentence on half

Chris Devon

Power Member
Joined
Jul 2, 2008
Messages
526
Reaction score
305
I have a problem. I need to split a sentence on half.
Here is the example:

"All code must be placed within the appropriate CODE tags!"

So when it's split it will be

String 1: All code must be placed
String 2: within the appropriate CODE tags!

Does someone have any idea how to do it?

I know how to do a normal split in php for that example, but i need to make a script that would work with any sentence. Any help or pointer is appreciated.
 
I don`t care for php, but it seems the algo would be something like this :
1. $sentence = Identify a sentence by "." ,"!" ,"?".
2. $whitespaces = Identify the number of white spaces in $sentence.
3. trim sentence by $ whitespaces/2

You can figure out the details . This is very crude but I hope It`s of some use.

LE: you posted "Solved" in the same at the same time I posted.
 
Last edited:
That's what i needed back then. The problem was logical. Anyways thanks for the effort
 
Back
Top