Limit the output of words to 300 chars
How can I Limit the output of words to 300 chars but don't cut off a word in the middle? Thanks, Nathan P.S. I know I should know but I don't have time to find it can someone help me.. see you all at the Conf in DC!! Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
RE: Limit the output of words to 300 chars
Easy do a left(string,300) then reverse the string and find the first space get the position and then do a mid on that? Some of these quesations are very basic programming skills guys! regards Andrew Scott Senior Cold Fusion Application Developer ANZ eCommerce Centre * Ph 9273 0693 * [EMAIL PROTECTED] -Original Message- From: Nathan Stanford [mailto:[EMAIL PROTECTED]] Sent: 30 October 2000 14:29 To: CF-Talk Subject: Limit the output of words to 300 chars How can I Limit the output of words to 300 chars but don't cut off a word in the middle? Thanks, Nathan P.S. I know I should know but I don't have time to find it can someone help me.. see you all at the Conf in DC!! Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED] Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
Re: Limit the output of words to 300 chars
on 10/30/00 1:35 PM, Scott, Andrew at [EMAIL PROTECTED] wrote: Easy do a left(string,300) then reverse the string and find the first space get the position and then do a mid on that? Some of these quesations are very basic programming skills guys! Some of these posters are very intolerant... -- Rob Keniger big bang solutions mailto:[EMAIL PROTECTED] http://www.bigbang.net.au Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
Re: Limit the output of words to 300 chars
Andrew, Thanks for posting a possible solution but why bother if youre gonna belittle? STFW your a "seasoned professional" - lots of people are here to learn. Lay off the cafe' and keep your arrogance to your small self. Steve - Original Message - on 10/30/00 1:35 PM, Scott, Andrew at [EMAIL PROTECTED] wrote: Easy do a left(string,300) then reverse the string and find the first space get the position and then do a mid on that? Some of these quesations are very basic programming skills guys! Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
RE: Limit the output of words to 300 chars
Please Andrew. Lay off the cheap sentimentality. All this lovin' is getting a little mushy. btw, your solution will get rid of the last word in the 300 characters, even if the word was complete, which may not be exactly what you want. Sometimes basic is not so basic. Take a look at char 301. If it's whitespace, or maybe even punctuation, you can leave your 300 chars alone. And that's just the start of the fun. Neatest, most elegant solution to this near-but-not-quite trivial problem wins a beautiful set of steak knives. Lee (Bjork) Borkman http://bjork.net ColdFusion Tags by Bjork -Original Message- From: Scott, Andrew [mailto:[EMAIL PROTECTED]] Easy do a left(string,300) then reverse the string and find the first space get the position and then do a mid on that? Some of these quesations are very basic programming skills guys! regards Andrew Scott -Original Message- From: Nathan Stanford [mailto:[EMAIL PROTECTED]] How can I Limit the output of words to 300 chars but don't cut off a word in the middle? IMPORTANT NOTICE: This e-mail and any attachment to it is intended only to be read or used by the named addressee. It is confidential and may contain legally privileged information. No confidentiality or privilege is waived or lost by any mistaken transmission to you. If you receive this e-mail in error, please immediately delete it from your system and notify the sender. You must not disclose, copy or use any part of this e-mail if you are not the intended recipient. The RTA is not responsible for any unauthorised alterations to this e-mail or attachment to it. Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
RE: Limit the output of words to 300 chars
*s* You are welcome to your comments, as I am welcome to mine! But I just wanted to say that this is an easy thing that even the most basic programers can figure out... but hey I guess CF attracts a lot of non programmers then regards Andrew Scott Senior Cold Fusion Application Developer -Original Message- From: Stephen M. Aylor [mailto:[EMAIL PROTECTED]] Sent: 30 October 2000 14:39 To: CF-Talk Subject: Re: Limit the output of words to 300 chars Andrew, Thanks for posting a possible solution but why bother if youre gonna belittle? STFW your a "seasoned professional" - lots of people are here to learn. Lay off the cafe' and keep your arrogance to your small self. Steve - Original Message - on 10/30/00 1:35 PM, Scott, Andrew at [EMAIL PROTECTED] wrote: Easy do a left(string,300) then reverse the string and find the first space get the position and then do a mid on that? Some of these quesations are very basic programming skills guys! Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED] Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
RE: Limit the output of words to 300 chars
Well thats the price you pay, for example you would need to expand the concept a bit more. Does the last position (301) contain a space, then you wouldn't need to go back any further, or is it a comma or a full stop. You see if you think about it then the solution is simple! There are no hard and fast methods, its what you program at the time for what you need. In my case when I first did something like this, it didn't matter it was words upto 300 chars. No if you want to throw more conditions on top of this then you can do what you need! regards Andrew Scott Senior Cold Fusion Application Developer ANZ eCommerce Centre * Ph 9273 0693 * [EMAIL PROTECTED] -Original Message- From: BORKMAN Lee [mailto:[EMAIL PROTECTED]] Sent: 30 October 2000 14:51 To: CF-Talk Subject: RE: Limit the output of words to 300 chars Please Andrew. Lay off the cheap sentimentality. All this lovin' is getting a little mushy. btw, your solution will get rid of the last word in the 300 characters, even if the word was complete, which may not be exactly what you want. Sometimes basic is not so basic. Take a look at char 301. If it's whitespace, or maybe even punctuation, you can leave your 300 chars alone. And that's just the start of the fun. Neatest, most elegant solution to this near-but-not-quite trivial problem wins a beautiful set of steak knives. Lee (Bjork) Borkman http://bjork.net ColdFusion Tags by Bjork -Original Message- From: Scott, Andrew [mailto:[EMAIL PROTECTED]] Easy do a left(string,300) then reverse the string and find the first space get the position and then do a mid on that? Some of these quesations are very basic programming skills guys! regards Andrew Scott -Original Message- From: Nathan Stanford [mailto:[EMAIL PROTECTED]] How can I Limit the output of words to 300 chars but don't cut off a word in the middle? IMPORTANT NOTICE: This e-mail and any attachment to it is intended only to be read or used by the named addressee. It is confidential and may contain legally privileged information. No confidentiality or privilege is waived or lost by any mistaken transmission to you. If you receive this e-mail in error, please immediately delete it from your system and notify the sender. You must not disclose, copy or use any part of this e-mail if you are not the intended recipient. The RTA is not responsible for any unauthorised alterations to this e-mail or attachment to it. Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED] Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
Re: Limit the output of words to 300 chars
but hey I guess CF attracts a lot of non programmers then Andrew Scott Senior Cold Fusion Application Developer Your just now realizing this? Steve Aylor Basic Dude Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
RE: Limit the output of words to 300 chars
I don't know if this will qualify as either neat or elegant, but I believe that it will work. If not, please forgive me, I haven't tested it exhaustively ;) cfset partA = Left(test1,301) cfif Right(partA,1) EQ " " cfset final = partA cfelse cfset lastword = ListLast(partA," ") cfset final = Left(partA,Len(partA)-Len(lastword)) /cfif Note: test1 is the string we are truncating, final is the result Bob -Original Message- From: BORKMAN Lee [mailto:[EMAIL PROTECTED]] Sent: Sunday, October 29, 2000 10:51 PM To: CF-Talk Subject: RE: Limit the output of words to 300 chars Please Andrew. Lay off the cheap sentimentality. All this lovin' is getting a little mushy. btw, your solution will get rid of the last word in the 300 characters, even if the word was complete, which may not be exactly what you want. Sometimes basic is not so basic. Take a look at char 301. If it's whitespace, or maybe even punctuation, you can leave your 300 chars alone. And that's just the start of the fun. Neatest, most elegant solution to this near-but-not-quite trivial problem wins a beautiful set of steak knives. Lee (Bjork) Borkman http://bjork.net ColdFusion Tags by Bjork -Original Message- From: Scott, Andrew [mailto:[EMAIL PROTECTED]] Easy do a left(string,300) then reverse the string and find the first space get the position and then do a mid on that? Some of these quesations are very basic programming skills guys! regards Andrew Scott -Original Message- From: Nathan Stanford [mailto:[EMAIL PROTECTED]] How can I Limit the output of words to 300 chars but don't cut off a word in the middle? IMPORTANT NOTICE: This e-mail and any attachment to it is intended only to be read or used by the named addressee. It is confidential and may contain legally privileged information. No confidentiality or privilege is waived or lost by any mistaken transmission to you. If you receive this e-mail in error, please immediately delete it from your system and notify the sender. You must not disclose, copy or use any part of this e-mail if you are not the intended recipient. The RTA is not responsible for any unauthorised alterations to this e-mail or attachment to it. Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED] Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
RE: Limit the output of words to 300 chars
I simply stated I didn't have the time to figure it out and since it was sooo simple could someone point me in the right direction... by the way there are plenty of beginners and advanced people on this list... cfset startnum=Find(' ', Reverse(left(MyText,301)) , 1) cfset outvar=#mid(Reverse(left(MyText,301)),startnum,300)# #reverse(outvar)# Here is my final bit of code for all of the beginners and those of us who are too busy to have ALL of the answers. :) Nathan Stanford PS. I will be at the cf_underground on the expert panel so sorry to have bothered you. grin -Original Message- From: Scott, Andrew [mailto:[EMAIL PROTECTED]] Sent: Sunday, October 29, 2000 10:07 PM To: CF-Talk Subject: RE: Limit the output of words to 300 chars *s* You are welcome to your comments, as I am welcome to mine! But I just wanted to say that this is an easy thing that even the most basic programers can figure out... but hey I guess CF attracts a lot of non programmers then regards Andrew Scott Senior Cold Fusion Application Developer -Original Message- From: Stephen M. Aylor [mailto:[EMAIL PROTECTED]] Sent: 30 October 2000 14:39 To: CF-Talk Subject: Re: Limit the output of words to 300 chars Andrew, Thanks for posting a possible solution but why bother if youre gonna belittle? STFW your a "seasoned professional" - lots of people are here to learn. Lay off the cafe' and keep your arrogance to your small self. Steve - Original Message - on 10/30/00 1:35 PM, Scott, Andrew at [EMAIL PROTECTED] wrote: Easy do a left(string,300) then reverse the string and find the first space get the position and then do a mid on that? Some of these quesations are very basic programming skills guys! Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED] Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED] Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
FW: Limit the output of words to 300 chars
Ok, so I didn't account for punctuation! I guess that's what happens when you bang code out at 11:15 on a Sunday evening! -Original Message- From: Bob Silverberg [mailto:[EMAIL PROTECTED]] Sent: Sunday, October 29, 2000 11:06 PM To: CF-Talk Subject: RE: Limit the output of words to 300 chars I don't know if this will qualify as either neat or elegant, but I believe that it will work. If not, please forgive me, I haven't tested it exhaustively ;) cfset partA = Left(test1,301) cfif Right(partA,1) EQ " " cfset final = partA cfelse cfset lastword = ListLast(partA," ") cfset final = Left(partA,Len(partA)-Len(lastword)) /cfif Note: test1 is the string we are truncating, final is the result Bob -Original Message- From: BORKMAN Lee [mailto:[EMAIL PROTECTED]] Sent: Sunday, October 29, 2000 10:51 PM To: CF-Talk Subject: RE: Limit the output of words to 300 chars Please Andrew. Lay off the cheap sentimentality. All this lovin' is getting a little mushy. btw, your solution will get rid of the last word in the 300 characters, even if the word was complete, which may not be exactly what you want. Sometimes basic is not so basic. Take a look at char 301. If it's whitespace, or maybe even punctuation, you can leave your 300 chars alone. And that's just the start of the fun. Neatest, most elegant solution to this near-but-not-quite trivial problem wins a beautiful set of steak knives. Lee (Bjork) Borkman http://bjork.net ColdFusion Tags by Bjork -Original Message- From: Scott, Andrew [mailto:[EMAIL PROTECTED]] Easy do a left(string,300) then reverse the string and find the first space get the position and then do a mid on that? Some of these quesations are very basic programming skills guys! regards Andrew Scott -Original Message- From: Nathan Stanford [mailto:[EMAIL PROTECTED]] How can I Limit the output of words to 300 chars but don't cut off a word in the middle? IMPORTANT NOTICE: This e-mail and any attachment to it is intended only to be read or used by the named addressee. It is confidential and may contain legally privileged information. No confidentiality or privilege is waived or lost by any mistaken transmission to you. If you receive this e-mail in error, please immediately delete it from your system and notify the sender. You must not disclose, copy or use any part of this e-mail if you are not the intended recipient. The RTA is not responsible for any unauthorised alterations to this e-mail or attachment to it. Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED] Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED] Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
CHILL! Re: Limit the output of words to 300 chars
Hey Andrew, Jump off that BIG horse... I'm SURE, and I know there are those whom have more knowledge then yourself. But do you see them crashing you development when you don't answer question correctly.So take a chill no one calling you a non programmer. HISTORY: http://listserver.tved.net.au/pipermail/cfaussie/2000-August/000283.html http://www.allaire.com/Products/ColdFusion/features/CF45ServerFeatureMatrix. pdf -Brian - Original Message - From: Scott, Andrew [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Sunday, October 29, 2000 9:06 PM Subject: RE: Limit the output of words to 300 chars *s* You are welcome to your comments, as I am welcome to mine! But I just wanted to say that this is an easy thing that even the most basic programers can figure out... but hey I guess CF attracts a lot of non programmers then regards Andrew Scott Senior Cold Fusion Application Developer -Original Message- From: Stephen M. Aylor [mailto:[EMAIL PROTECTED]] Sent: 30 October 2000 14:39 To: CF-Talk Subject: Re: Limit the output of words to 300 chars Andrew, Thanks for posting a possible solution but why bother if youre gonna belittle? STFW your a "seasoned professional" - lots of people are here to learn. Lay off the cafe' and keep your arrogance to your small self. Steve - Original Message - on 10/30/00 1:35 PM, Scott, Andrew at [EMAIL PROTECTED] wrote: Easy do a left(string,300) then reverse the string and find the first space get the position and then do a mid on that? Some of these quesations are very basic programming skills guys! -- -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED] -- -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED] Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
RE: Limit the output of words to 300 chars
*LOL* regards Andrew Scott Senior Cold Fusion Application Developer ANZ eCommerce Centre * Ph 9273 0693 * [EMAIL PROTECTED] -Original Message- From: Stephen M. Aylor [mailto:[EMAIL PROTECTED]] Sent: 30 October 2000 15:05 To: CF-Talk Subject: Re: Limit the output of words to 300 chars but hey I guess CF attracts a lot of non programmers then Andrew Scott Senior Cold Fusion Application Developer Your just now realizing this? Steve Aylor Basic Dude Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
RE: CHILL! Re: Limit the output of words to 300 chars
Down here, we have what we refer to lovingly as "the Ugly Australian". It's a much-valued tradition that Andrew is trying his best to perpetuate. All power to him, I say. Lee (Bjork) Borkman http://bjork.net ColdFusion Tags by Bjork -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Hey Andrew, Jump off that BIG horse... I'm SURE, and I know there are those whom have more knowledge then yourself. But do you see them crashing you development when you don't answer question correctly.So take a chill no one calling you a non programmer. IMPORTANT NOTICE: This e-mail and any attachment to it is intended only to be read or used by the named addressee. It is confidential and may contain legally privileged information. No confidentiality or privilege is waived or lost by any mistaken transmission to you. If you receive this e-mail in error, please immediately delete it from your system and notify the sender. You must not disclose, copy or use any part of this e-mail if you are not the intended recipient. The RTA is not responsible for any unauthorised alterations to this e-mail or attachment to it. Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
Re: Limit the output of words to 300 chars
From: "Nathan Stanford" [EMAIL PROTECTED] How can I Limit the output of words to 300 chars but don't cut off a word in the middle? In psuedo code -- target define word ListInsertAt 300th word some_unused_char_as_delimiter goal = ListFirst(target) in CF ( not guaranteed) this is verbose and explicit, there should be a regex that can do the same in one step (Rick Osborne??) !--- define: word n chars ending in chr(32) cfset spc=chr(32) cfset lf=chr(10) cfset cr=chr(13) cfset lfcr=lf cr cfset rareChar=chr(135) cfset thisFile="c:\foo\some_tract.txt" cffile action = "read" file=#thisFile# variable=txt cfset sanityCheck=FindOneOf(#spc#,txt) cfset yesLF=FindOneOf(#lf#,txt) cfset yesCR=FindOneOf(#cr#,txt) cfif(sanityCheck) cfset isIt_unix_or_dos_or_charStream=yesLF + yesCR cfswitch expression="#isIt_unix_or_dos#" cfcase value=0 !--- it's char stream !--- do nothing --- /cfcase cfcase value=1 !--- must be unix cfset txt=ReplaceNoCase(txt,#lf#,#spc#,"ALL") /cfcase cfcase value=2!--- it's dos cfset txt=ReplaceNocase(txt,#lfcr#,#spc#,"ALL") /cfcase /cfswitch !--- now we have a stream of char representable as one long line --- !--- if the txt is properly punctuated, (cf. differences tween English English and American English) then txt is finished being prepped. Might add in recursive code to replace instances where chr32 appears more than once in any given char sequence. Probably should do this as some do two chr32 after periods and some do one chr32. Code is trivial and left as exercise :) - cfset txt=ListSetAt(txt,300,#rareChar#,#spc#) cfset goal=ListFirst(txt,#rareChar#) cfelse cfoutputredefine wordbrcfabort/cfoutput /cfif rareChar selection should be informed by awareness of language used in txt and by general knowledge of context I.E. chr(135) will be likely in highly footnoted tracts from academic types (especially history majors :) ). Pan - the one and only Baroque programmer Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
Re: Limit the output of words to 300 chars ---- it even says chars in the subject line
ARRRGH ! Too late he wrote "limit to 300 chars" NOT 300 words Pan - abashed, no excuses Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]