Hello,
This statement here can return a very long paragraph
<%=h openjob.ProblemDesc %>
Is there a way to trim it to say the first 50 characters? In VBScript
I would use Left(). (I am working in ruby on rails if that matters)
Hello,
This statement here can return a very long paragraph
<%=h openjob.ProblemDesc %>
Is there a way to trim it to say the first 50 characters? In VBScript
I would use Left(). (I am working in ruby on rails if that matters)
openjob.ProblemDesc[0..49] should do the trick.
On 9/17/07, Cryptographic_ICE@yahoo.com <Cryptographic_ICE@yahoo.com> wrote:
Hello,
This statement here can return a very long paragraph
<%=h openjob.ProblemDesc %>Is there a way to trim it to say the first 50 characters? In VBScript
I would use Left(). (I am working in ruby on rails if that matters)
--
"Hey brother Christian with your high and mighty errand, Your actions speak
so loud, I can't hear a word you're saying."
-Greg Graffin (Bad Religion)
Rails also has a helper for this:
http://api.rubyonrails.com/classes/ActionView/Helpers/TextHelper.html#M00061
5
truncate("Once upon a time in a world far far away", 14)
=> Once upon a...
HTH,
FElix
-----Original Message-----
From: Glen Holcomb [mailto:damnbigman@gmail.com]
Sent: Monday, September 17, 2007 12:20 PM
To: ruby-talk ML
Subject: Re: Cropping text stringsopenjob.ProblemDesc[0..49] should do the trick.
On 9/17/07, Cryptographic_ICE@yahoo.com > <Cryptographic_ICE@yahoo.com> wrote:
>
> Hello,
>
> This statement here can return a very long paragraph
> <%=h openjob.ProblemDesc %>
>
> Is there a way to trim it to say the first 50 characters?
In VBScript
> I would use Left(). (I am working in ruby on rails if that matters)
>
>
>--
"Hey brother Christian with your high and mighty errand, Your
actions speak
so loud, I can't hear a word you're saying."-Greg Graffin (Bad Religion)
As will the following:
openjob.ProblemDesc.first(50)
Regards, Morton
On Sep 17, 2007, at 3:20 PM, Glen Holcomb wrote:
openjob.ProblemDesc[0..49] should do the trick.
On 9/17/07, Cryptographic_ICE@yahoo.com > <Cryptographic_ICE@yahoo.com> wrote:
Hello,
This statement here can return a very long paragraph
<%=h openjob.ProblemDesc %>Is there a way to trim it to say the first 50 characters? In VBScript
I would use Left(). (I am working in ruby on rails if that matters)
Glen Holcomb wrote:
openjob.ProblemDesc[0..49] should do the trick.
Hate to be anal, but that would return the first 50 *bytes*, not characters.
Daniel
Thank you it worked great!
On Sep 17, 3:41 pm, Morton Goldberg <m_goldb...@ameritech.net> wrote:
On Sep 17, 2007, at 3:20 PM, Glen Holcomb wrote:
> openjob.ProblemDesc[0..49] should do the trick.
> On 9/17/07, Cryptographic_...@yahoo.com > > <Cryptographic_...@yahoo.com> wrote:
>> Hello,
>> This statement here can return a very long paragraph
>> <%=h openjob.ProblemDesc %>>> Is there a way to trim it to say the first 50 characters? In VBScript
>> I would use Left(). (I am working in ruby on rails if that matters)As will the following:
openjob.ProblemDesc.first(50)
Regards, Morton
Good point, I wasn't thinking in Unicode.
On 9/17/07, Daniel DeLorme <dan-ml@dan42.com> wrote:
Glen Holcomb wrote:
> openjob.ProblemDesc[0..49] should do the trick.Hate to be anal, but that would return the first 50 *bytes*, not
characters.Daniel
--
"Hey brother Christian with your high and mighty errand, Your actions speak
so loud, I can't hear a word you're saying."
-Greg Graffin (Bad Religion)
Hi,
Am Dienstag, 18. Sep 2007, 04:41:14 +0900 schrieb Morton Goldberg:
On Sep 17, 2007, at 3:20 PM, Glen Holcomb wrote:
Is there a way to trim it to say the first 50 characters?
As will the following:
openjob.ProblemDesc.first(50)
Cool. Here are two other ones:
openjob.ProblemDesc[ 0, 50]
openjob.ProblemDesc[ /.{50}/u]
Bertram
--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de
# > Hate to be anal, but that would return the first 50 *bytes*, not
# > characters.
# Good point, I wasn't thinking in Unicode.
ruby1.9 http://eigenclass.org/hiki.rb?Changes+in+Ruby+1.9#l104
From: Glen Holcomb [mailto:damnbigman@gmail.com]
# On 9/17/07, Daniel DeLorme <dan-ml@dan42.com> wrote:
Nice! I won't have to think in Unicode ![]()
On 9/18/07, Peña, Botp <botp@delmonte-phil.com> wrote:
From: Glen Holcomb [mailto:damnbigman@gmail.com]
# On 9/17/07, Daniel DeLorme <dan-ml@dan42.com> wrote:
# > Hate to be anal, but that would return the first 50 *bytes*, not
# > characters.
# Good point, I wasn't thinking in Unicode.ruby1.9 http://eigenclass.org/hiki.rb?Changes+in+Ruby+1.9#l104
--
"Hey brother Christian with your high and mighty errand, Your actions speak
so loud, I can't hear a word you're saying."
-Greg Graffin (Bad Religion)