Path: utzoo!attcan!uunet!cs.utexas.edu!usc!polyslo!vlsi3b15!lehi3b15!lxn!chris From: chris@lxn.eds.com (Christopher D. Orr) Newsgroups: comp.emacs Subject: Lisp Programming: Substring Searches, etc. Keywords: lisp substring searches case statements Message-ID: <397@lxn.eds.com> Date: 9 Jul 89 01:58:06 GMT Reply-To: chris@lxn.eds.com (Christopher D. Orr) Organization: Electronic Data Systems, Center Valley, PA Lines: 34 I am trying to write an extention to GNU Emacs that will perform a function based upon characteristics of the filename. Mainly, what I want to be able to do is to perform a case statment such as the following shell extract: case $FILE_EXT in c) SUBBASE=`echo $1 | cut -c1-3 | tr [a-z] [A-Z]`;; h) SUBBASE=`echo $1 | cut -c1-3 | tr [a-z] [A-Z]`;; f) SUBBASE=FILESPEC;; s) SUBBASE=`echo $1 | cut -c1-3 | tr [a-z] [A-Z]`;; m) SUBBASE=MENUSPEC;; *) SUBBASE=MISC FILE=$1;; where FILE_EXT is set to the extention of the file being operated on. My questions are: 1) How do I set up a case statement in GNU Lisp to perform this? 2) How do you extract a substring from a string object (i.e. buffer-file-name) ? I need to be able to scan for the period "." and then operate on the remaining portion of the string in the case statement. Any help that anybody can provide will be very helpfull!!! --Chris -- Christopher D. Orr | US MAIL: Electronic Data Systems (EDS) UUCP: vu-vlsi!lxn!chris | Lanark Building or chris%lxn.uucp@rutgers.edu | Center Valley, PA 18034 or lehi3b15!lxn!chris | Voice: (215) 282-1213