Subject: | |
From: | |
Reply To: | |
Date: | Wed, 7 Jun 2000 11:13:04 -0400 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
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
|
|
|