On Wed, 7 Jun 2000 11:13:04 -0400, Ted Ashton <[log in to unmask]> wrote: >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 ====================================================================== Ah, but remember, the original post was not asking for a solution from any langauge except COBOL. So why answer with a solution from Perl, Python or Powerhouse. I know all four languages, but simply answered the man's question. By the way, how would you do it in RPG? PL1? SPL? C++? FORTRAN? PASCAL? JAVA? (Is JAVA a language? Is a PC a real computer?) Randy Keefer, Consultant PS. Obviously, all opinions expressed are my own and do not represent those of Hughes Network Systems or any of its employees. >-- >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