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:
Reply To:
Ted Ashton <[log in to unmask]>
Date:
Wed, 7 Jun 2000 11:13:04 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (29 lines)
Thus it was written in the epistle of Benji York,
>
> 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".

And, of course, Perl's contribution:

$last_four = substr($my_string,-4);

Ted
--
Ted Ashton ([log in to unmask]), Info Sys, Southern Adventist University
          ==========================================================
There are problems to whose solution I would attach an infinitely greater
importance than to those of mathematics, for example touching ethics, or our
relation to God, or concerning our destiny and our future; but their
solution lies wholly beyond us and completely outside the province of
science.
                                           -- Gauss, Karl Friedrich (1777-1855)
          ==========================================================
         Deep thoughts to be found at http://www.southern.edu/~ashted

ATOM RSS1 RSS2