Cropping text strings

C

Cryptographic_ICE

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)
 
M

Morton Goldberg

openjob.ProblemDesc[0..49] should do the trick.

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
 
B

Bertram Scharpf

Hi,

Am Dienstag, 18. Sep 2007, 04:41:14 +0900 schrieb Morton Goldberg:
As will the following:

openjob.ProblemDesc.first(50)

Cool. Here are two other ones:

openjob.ProblemDesc[ 0, 50]
openjob.ProblemDesc[ /.{50}/u]

Bertram
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top