Re: Break Word
From: Tim Van Wassenhove (euki_at_pi.be)
Date: 06/14/04
- Next message: Phil Roberts: "Re: type hinting with optional arguments"
- Previous message: Tim Van Wassenhove: "Re: Wap via PHP?"
- In reply to: knoak: "Break Word"
- Next in thread: knoak: "Re: Break Word"
- Reply: knoak: "Re: Break Word"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 14 Jun 2004 18:18:28 GMT
In article <a5e41e0e.0406140652.4a0bb43@posting.google.com>, knoak wrote:
> How can i detect after submitting if any word
> from the field is longer then e.g. 15 chars.
> If so, break it at the 14th char, add a dash,
> an continue at the next line...
It depends on what you depend what a word is.
Assuming that every group of characters that is separated by space is
defined as a word.
You could easily lookup with strpos where the spaces occur in a string.
The distance between 2 such positions would be the length of the word.
Or you could use the split function to get all the "words" and use
strlen to determine how long they are.
After this you can use substr to grab parts out of such a word.
More on the functions mentionned above can be found at
http://www.php.net/manual -> string functions.
-- Tim Van Wassenhove <http://home.mysth.be/~timvw>
- Next message: Phil Roberts: "Re: type hinting with optional arguments"
- Previous message: Tim Van Wassenhove: "Re: Wap via PHP?"
- In reply to: knoak: "Break Word"
- Next in thread: knoak: "Re: Break Word"
- Reply: knoak: "Re: Break Word"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|