Re: Some pointers please
This WebDNA talk-list message is from 2008
It keeps the original formatting.
numero = 69745
interpreted = N
texte = Hi CraigI think that I am correct in saying that you don't want to break a word only break at a space.I use this to create a panel that only has 48 characters long and will break at a space. I have pulled it out of a template, hopefully it will work for you, may need some tweeking as I used it in building dynamic PDFs.Should get you started :)= = = = = ========================================================================[!]Initialize our variables CELL06 [/!][math show=f]count=0[/math][math show=f]numChar=[countchars][CELL06][/countchars][/math][text]curText=[/text][!]Loop through the message text one character at a time[/!][loop start=1&end=[numchar]][text]newLine=F[/text][text]curChar=[getchars start=[index]&end=[index]][CELL06][/getchars][/ text][math show=f]count=[count]+1[/math][!]This is a carriage return[/!][showif [url][curChar][/url]=%0D][text]curChar=[/text][/showif][!]This is a linefeed[/!][showif [url][curChar][/url]=%0A][text]curChar=[/text][text]newLine=T[/text][/showif][!]Add this character to our current text block - 48 characters long[/!][text]curText=[curText][curChar][/text][!]See if we need to wrap to a new line[/!][showif [count]>48][showif [url][curChar][/url]=%20][text]newLine=T[/text][/showif][/showif][!]Start a new line[/!][showif [newLine]=T][curText]
[math show=f]count=0[/math][text]curText=[/text][/showif][/loop][!]Show whatever text is left[/!][curText]
= = = = = ========================================================================RegardsStuart TremainIDFK Web DevelopmentsAUSTRALIAwebdna@idfk.com.auOn 03/02/2008, at 4:30 AM, Steve Craig wrote:> Hi>> I have a little problem with something and my brain isn't working so > any pointers or hints would be good.>> Basically I need to split a large text variable into 2 new > variables, the first 50 or so words into [var1] and then the rest > into [var2]>> It can't be just a set number of chars it must be to the nearest > complete word, and the second var must carry on from that point etc.>> Hope this is clear, any help would be much appreciated.>> Cheers> ========================================> Steve Craig - Asylum Interactive Ltd> Tel +44 1330 860550 Fax +44 1330 860880> ========================================> http://www.asylumweb.com> Email: steve@asylumweb.com> Skype: s.craig - iChat: steve.craig> ========================================>>>>> -------------------------------------------------------------> This message is sent to you because you are subscribed to> the mailing list
.> To unsubscribe, E-mail to: > To switch to the DIGEST mode, E-mail to >> Web Archive of this list is at: http://webdna.smithmicro.com/-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/
Associated Messages, from the most recent to the oldest:
Hi CraigI think that I am correct in saying that you don't want to break a word only break at a space.I use this to create a panel that only has 48 characters long and will break at a space. I have pulled it out of a template, hopefully it will work for you, may need some tweeking as I used it in building dynamic PDFs.Should get you started :)= = = = = ========================================================================[!]Initialize our variables CELL06 [/!][math show=f]count=0[/math][math show=f]numChar=[countchars][CELL06][/countchars][/math][text]curText=[/text][!]Loop through the message text one character at a time[/!][loop start=1&end=[numchar]][text]newLine=F[/text][text]curChar=[getchars start=[index]&end=[index]][CELL06][/getchars][/ text][math show=f]count=[count]+1[/math][!]This is a carriage return[/!][showif [url][curChar][/url]=%0D][text]curChar=[/text][/showif][!]This is a linefeed[/!][showif [url][curChar][/url]=%0A][text]curChar=[/text][text]newLine=T[/text][/showif][!]Add this character to our current text block - 48 characters long[/!][text]curText=[curText][curChar][/text][!]See if we need to wrap to a new line[/!][showif [count]>48][showif [url][curChar][/url]=%20][text]newLine=T[/text][/showif][/showif][!]Start a new line[/!][showif [newLine]=T][curText]
[math show=f]count=0[/math][text]curText=[/text][/showif][/loop][!]Show whatever text is left[/!][curText]
= = = = = ========================================================================RegardsStuart TremainIDFK Web DevelopmentsAUSTRALIAwebdna@idfk.com.auOn 03/02/2008, at 4:30 AM, Steve Craig wrote:> Hi>> I have a little problem with something and my brain isn't working so > any pointers or hints would be good.>> Basically I need to split a large text variable into 2 new > variables, the first 50 or so words into [var1] and then the rest > into [var2]>> It can't be just a set number of chars it must be to the nearest > complete word, and the second var must carry on from that point etc.>> Hope this is clear, any help would be much appreciated.>> Cheers> ========================================> Steve Craig - Asylum Interactive Ltd> Tel +44 1330 860550 Fax +44 1330 860880> ========================================> http://www.asylumweb.com> Email: steve@asylumweb.com> Skype: s.craig - iChat: steve.craig> ========================================>>>>> -------------------------------------------------------------> This message is sent to you because you are subscribed to> the mailing list .> To unsubscribe, E-mail to: > To switch to the DIGEST mode, E-mail to >> Web Archive of this list is at: http://webdna.smithmicro.com/-------------------------------------------------------------This message is sent to you because you are subscribed to the mailing list .To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/
Stuart Tremain
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:
Date sorting (1997)
Looping control (1997)
LAST CHANCE! Anyone have a one-to-one messaging system? (1999)
updating a series of records via a text file? (1999)
PSC recommends what date format yr 2000??? (1997)
Web Catalog 2 demo (1997)
serial number dishing (1997)
Prevent multiple appends with Reload Button (1997)
Max Record length (1997)
Database Security (1998)
WebCat2 Append problem (B14Macacgi) (1997)
pictures / referrer etc. (1998)
WebDNA maxing out processor (2008)
HELP WITH DATES (1997)
find with exceptions (1997)
Problem with [math] (2000)
Get current URL with Variables (2005)
Trigger alternatives please ... (2004)
formvariable funkyness (2000)
New Command prefs ... (1997)