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:
Search/sort in URL Was: GuestBook example (1997)
Unable to view next 101-200 (1997)
How much is too much? I can never remember the answer. (2002)
Banners (1997)
Automated FTP from Shell (2004)
Sort Order on a page search (1997)
about this server and links to who (1997)
Testing band width (2002)
Help name our technology! (1997)
PCS Frames (1997)
Same DB Same Time (2004)
WC2b15 File Corruption (1997)
[OT] degree symbol (2003)
Hideif not working? (2001)
relogin same user? (1998)
first time using webcats sendmail option (2001)
weird [hideif] happenings maybe . . . (2003)
Moment of Thanks (1997)
Intermitent problem using [referrer] (1997)
[WebDNA] shopping sites and the "old commerce tags" (2012)