Matias
August 3, 2006, 2:23pm
#1
Hi,
I’ve seen some time ago a function which, given a string like “this is a
very long string” would return , for example limitin it to 10 chars
“this
is a…” , but I can’t remember where… I’ve searched throwth the
apis
of rails and ruby itself and I can’t find it.
Thanks everybody…
Matias
August 3, 2006, 2:23pm
#2
Matias
August 3, 2006, 2:23pm
#3
mmm… neither of both…
I’m talking of something like this:
“my very long string again”.funky_function(10) ==> “my very lo…”
I know it’s very easy to implement… I think I’ll end going that way.
Thanks
Uchiha Itachi
escribió:
Slice? or Split?
Matias
August 3, 2006, 2:23pm
#4
That’s exactly what I was looking for… thanks a lot.
Ezra Z.
escribió:
Matias
August 3, 2006, 7:25pm
#5
On 8/2/06, Ezra Z. [email protected] wrote:
is a…" , but I can’t remember where… I’ve searched throwth
-Ezra
Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails
what object/module is this truncate method defined on?
Matias
August 3, 2006, 7:39pm
#6
linux user wrote:
what object/module is this truncate method defined on?
ActionView::Helpers::TextHelper
The appropriate API documentation is here:
http://api.rubyonrails.com/classes/ActionView/Helpers/TextHelper.html#M000505
Matias
August 4, 2006, 8:13am
#7
On Aug 3, 2006, at 9:58 AM, linux user wrote:
very long string" would return , for example limitin it to 10 chars
http://lists.rubyonrails.org/mailman/listinfo/rails
what object/module is this truncate method defined on?
Sorry, its a view helper. So it is available in all views.
-Ezra
Matias
August 3, 2006, 2:23pm
#8
On Aug 2, 2006, at 3:00 PM, Matias wrote:
Thanks everybody…
Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails
str = “This is a long string This is a long string This is a long
string This is a long string This is a long string”
truncate str, 20
That will truncate the string to 20 chars and add a ‘…’ to the end.
-Ezra