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