HP3000-L Archives

June 2000, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Benji York <[log in to unmask]>
Reply To:
Date:
Wed, 7 Jun 2000 09:40:05 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (1 lines)


Pickering, John wrote:

> <long explanation of Cobol's string capabilities :-( snipped>

>

> Thanks Glenn. You've provided a great reminder of why I'm still impressed

> with PowerHouse.

>

> define d-last-four char*4 &

>   = my-string of my-file &

>  if 4 ge size(tru(my-string of my-file)) &

> els my-string of my-file &

>     [size(tru(my-string of my-file))-3:4]

>

> Now I'd better set my 3000-l options to nomail before the flood of abuse

> from Cobol supporters starts :-)

>

> Regards,

> JWP



Not to start a language war :), but after seeing the code in COBOL and

PowerHouse to grab the last four characters from a string, I thought I'd

just throw out the Pythonic way:



lastFour = myString[-4:]



Python uses the idea of string slicing (much like several other languages),

but has some nice things like being able to use negative numbers to

represent "from the end".





Benji (putting on the asbestos underwear) York


ATOM RSS1 RSS2