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:
WebMerchant 3.0 for Mac shipping now (1998)
Server slowing down. (1997)
Browsername (2000)
Nesting [ListFiles] (1998)
b12 cannot limit records returned and more. (1997)
converting tabs (1997)
b12 cannot limit records returned and more. (1997)
Version 4? (2000)
[search] in formulas.db (1997)
[WebDNA] Open source WebDNA? (2012)
Re(2): NT version and O'reily's WebSite (1997)
[defined]ish (1997)
[WebDNA] Different results for [THISURL] (2018)
[shownext] support - MacOS (1997)
Sense/Disallow HTML tags during $Append (1997)
Plugin or CGI or both (1997)
typhoon... (1997)
I'm new be kind (1997)
More news on 5.0 (2003)
WebCat2b12 CGI Mac -- Problems propagating the cart through (1997)