Re: [WebDNA] How to stop cutting a word
This WebDNA talk-list message is from 2008
It keeps the original formatting.
numero = 100227
interpreted = N
texte = [listchars chars=[sometext]][!][/!][showif [index]<241][char][/showif][!][/!][if (([index]>240) & ([index]<260) & ([done]!T))][!][/!][Then][char][showif [char]= ][text]done=T[/text][/showif][/Then][!][/!][Else][/Else][/if][!][/!][/listchars]This might work.BillOn Thu, Jul 3, 2008 at 3:55 PM, Matthew Bohne
wrote:> Untested, but I would just keep a running tally until you hit your limit.> If [break] works inside [listwords], then put a hideif containing a [break]> before your showif. Then it would act like a Do...Until loop.>> [text show=f]strText=Lorem ipsum dolor sit amet, consectetur adipisicing> elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut> enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut> aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in> voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint> occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit> anim id est laborum.[/text]>> [math show=f]intCutOff=220[/math]> [math show=f]intCount=0[/math]> [text show=f]txtShort=[/text]>> [listwords words=[strText]&delimiters=]> [showif [intCount]<[intCutOff]]> [text show=f]txtShort=[hideif [txtShort]=][txtShort]> [/hideif][word][/text]> [math> show=f]intCount=[intCount]+[countchars][word][/countchars][/math]> [/showif]> [/listwords]>> [txtShort]>>> Matthew Bohne>>>> Charles Kline wrote:>>>> [text show=f]BODY=MacBook Air takes laurels in three-way usability>> competition Of three ultrathin portables - MacBook Air, Toshiba Portege, and>> Lenovo ThinkPad - which is the most usable? To find out, Computerworld>> turned to usability experts and 20 impartial testers. Those testers, David>> Haskin relates, found MacBook Air the most usable, the most fun, and the>> best value of the three. In fact, they made MacBook Air "the clear winner>> when asked which laptop they'd purchase." Pro Tip of the Week: Become a>> Spaces Cadet When open windows start piling up on your desktop, Mac OS X>> Leopard provides a great way to establish control. Spaces. How can Spaces>> help you get more organized? Find out by reading the latest Pro Tip of the>> Week.[/text]>>>> [GETCHARS>> start=1&end=200&trim=both][REMOVEHTML][Body][/REMOVEHTML][/GETCHARS]>>>>>> Returns:>>>> MacBook Air takes laurels in three-way usability competition Of three>> ultrathin portables - MacBook Air, Toshiba Portege, and Lenovo ThinkPad ->> which is the most usable? To find out, Computerworld tur>>>> I think you are just getting lucky :)>>>>>> - Charles>>>> On Jul 3, 2008, at 9:16 AM, Frank Nordberg wrote:>>>>> Stuart Tremain wrote:>>>>>>> It is meant to cut off a block of text between char 220 to 260 but only>>>> at a space, ie not cutting a word in half>>>>>> This is the code I use for a similar purpose:>>>>>> [GETCHARS>>> start=1&end=200&trim=both][REMOVEHTML][Body][/REMOVEHTML][/GETCHARS]>>>>>> It seems to work fine but looking at it now, I can't understand why.>>> According to the WebDNA documentation the "trim=both" parameter only removes>>> spaces that may have ended up at the beginning or end of the string but it>>> apparently it's much more useful than that, removing incomplete words from>>> the ends of the string as well.>>>>>>>>>>>>>>
Associated Messages, from the most recent to the oldest:
[listchars chars=[sometext]][!][/!][showif [index]<241][char][/showif][!][/!][if (([index]>240) & ([index]<260) & ([done]!T))][!][/!][Then][char][showif [char]= ][text]done=T[/text][/showif][/Then][!][/!][Else][/Else][/if][!][/!][/listchars]This might work.BillOn Thu, Jul 3, 2008 at 3:55 PM, Matthew Bohne wrote:> Untested, but I would just keep a running tally until you hit your limit.> If [break] works inside [listwords], then put a hideif containing a [break]> before your showif. Then it would act like a Do...Until loop.>> [text show=f]strText=Lorem ipsum dolor sit amet, consectetur adipisicing> elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut> enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut> aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in> voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint> occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit> anim id est laborum.[/text]>> [math show=f]intCutOff=220[/math]> [math show=f]intCount=0[/math]> [text show=f]txtShort=[/text]>> [listwords words=[strText]&delimiters=]> [showif [intCount]<[intCutOff]]> [text show=f]txtShort=[hideif [txtShort]=][txtShort]> [/hideif][word][/text]> [math> show=f]intCount=[intCount]+[countchars][word][/countchars][/math]> [/showif]> [/listwords]>> [txtShort]>>> Matthew Bohne>>>> Charles Kline wrote:>>>> [text show=f]BODY=MacBook Air takes laurels in three-way usability>> competition Of three ultrathin portables - MacBook Air, Toshiba Portege, and>> Lenovo ThinkPad - which is the most usable? To find out, Computerworld>> turned to usability experts and 20 impartial testers. Those testers, David>> Haskin relates, found MacBook Air the most usable, the most fun, and the>> best value of the three. In fact, they made MacBook Air "the clear winner>> when asked which laptop they'd purchase." Pro Tip of the Week: Become a>> Spaces Cadet When open windows start piling up on your desktop, Mac OS X>> Leopard provides a great way to establish control. Spaces. How can Spaces>> help you get more organized? Find out by reading the latest Pro Tip of the>> Week.[/text]>>>> [GETCHARS>> start=1&end=200&trim=both][removehtml][Body][/REMOVEHTML][/GETCHARS]>>>>>> Returns:>>>> MacBook Air takes laurels in three-way usability competition Of three>> ultrathin portables - MacBook Air, Toshiba Portege, and Lenovo ThinkPad ->> which is the most usable? To find out, Computerworld tur>>>> I think you are just getting lucky :)>>>>>> - Charles>>>> On Jul 3, 2008, at 9:16 AM, Frank Nordberg wrote:>>>>> Stuart Tremain wrote:>>>>>>> It is meant to cut off a block of text between char 220 to 260 but only>>>> at a space, ie not cutting a word in half>>>>>> This is the code I use for a similar purpose:>>>>>> [GETCHARS>>> start=1&end=200&trim=both][removehtml][Body][/REMOVEHTML][/GETCHARS]>>>>>> It seems to work fine but looking at it now, I can't understand why.>>> According to the WebDNA documentation the "trim=both" parameter only removes>>> spaces that may have ended up at the beginning or end of the string but it>>> apparently it's much more useful than that, removing incomplete words from>>> the ends of the string as well.>>>>>>>>>>>>>>
"William DeVaul"
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
Email encryption (1998)
SQL Error 22003 (2001)
Showif, Hideif reverse logic ? (1997)
Limiting user access to .tmpl files (1997)
Adding multiple items to cart with one click? (2000)
[append] and SSL (1997)
Subtotal Not Calculated on Invoice.html (1998)
Missing CR in message (2005)
Help name our technology! (1997)
Help name our technology! I found it (1997)
The List is Changing (1997)
Cart -> Date and Time (2004)
HELP!! problems with e-mail from WebCAT (1998)
Caching pages...again (2001)
Plaintext Email Attachment (2001)
Problems with shopping cart (1997)
WebCatalog2 Feature Feedback (1996)
japanese characters (1997)
Performance: deafening silence (1999)
writing db to disk (1997)