...

View Full Version : Resolved Auto insert 'space' on long words



[vengeance]
10-10-2009, 12:31 AM
Hi.

I want to create a function that automatically inserts spaces in long words/strings. Some people enjoy doing "@@@@@@@@@@@@@@@@@...[etc]" just to mess around - and it hops out of the webpage's layout and continues on and on.

Although I have put overflow: hidden; on my site, however I'd like to automatically insert a space in a string that's 20 characters or more without any spaces.

So @@@[20 times] -insert space here- @@@@[20 more] -insert space here-.
That way the text would just continue but get a line break on the page.

Thanks.

Fou-Lu
10-10-2009, 02:28 AM
Use wordwrap function with explicit cut:


$sLongString = '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@......';
$sBrokenString = wordwrap($sLongString, 20, ' ', true);

[vengeance]
10-10-2009, 10:54 AM
Use wordwrap function with explicit cut:


$sLongString = '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@......';
$sBrokenString = wordwrap($sLongString, 20, ' ', true);


Wow - that function is so simple, yet efficient! I thought I'd have to make a similar function myself to get what I wanted to achieve.

Worked, thanks!

kbluhm
10-10-2009, 12:42 PM
A while back I offered a means to wrap only long words, regardless of the length of the line. It may be of some help to you as well.

http://www.codingforums.com/showpost.php?p=827668&postcount=7



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum