snowball
04-11-2003, 06:51 PM
HI
Can anyone help?
I have some code which produces a variable called "head" containing the heading for a paragraph of text.
The heading must not be longer than 61 characters (including spaces) so I have used:
head = head.slice(head.indexOf('\s*')+1,head.indexOf('\s*')+61);
This works fine except if the heading is more than 61 chartacters it cuts it off mid word.
Can anyone come up with some code to follow what's above that would then remove any character(s) after the last space .....
I would really appreciate it.
Many thanks
snow ....
Can anyone help?
I have some code which produces a variable called "head" containing the heading for a paragraph of text.
The heading must not be longer than 61 characters (including spaces) so I have used:
head = head.slice(head.indexOf('\s*')+1,head.indexOf('\s*')+61);
This works fine except if the heading is more than 61 chartacters it cuts it off mid word.
Can anyone come up with some code to follow what's above that would then remove any character(s) after the last space .....
I would really appreciate it.
Many thanks
snow ....