You can do tons of stuff to strings. (I like playing arround with them.)
Here are a few from my stuff that i found right away that you might be interisted in if you wanted to play arround more.
;;;===================================================================;
;;; instr? ;
;;;-------------------------------------------------------------------;
;;; Returns the charater position of the first occurnce ;
;;; of the substring in the string ;
;;; ;
;;; Usage: (instr? "test" "this is a test of johns procedure" nil) ;
;;; > 11 (The index number of the first occurance.) ;
;;; ;
;;; Arguments: sstr - A sub-string to search for. ;
;;; str - A string to search. ;
;;; c-sen - T = case matters ;
;;; nil = Case dose not matter ;
;;; ;
;;; Notes: This procedure uses recursion, so handeling a large lists ;
;;; is not recomemded. (you could get a stack error.) ;
;;; ;
;;; Author: John Kaul ;
;;; ;
;;; Revision History: ;
;;; 0.1 - initial release ;
;;; 0.2 - added case sensitivity ;
;;; ;
;;; TODO: ;
;;; Add the option to choose case sensitivity. ~DONE~ ;
;;;===================================================================;
;;; Previous versions ;
;;;-------------------------------------------------------------------;
;;; ver 0.1 ;
;;;-------------------------------------------------------------------;
;;; (defun instr? (sstr str / a)
;;; (defun isinstr-nest (sstr str)
;;; (cond ((> (strlen str) 0)
;;; (if (eq sstr (substr str 1 (strlen sstr)))
;;; str
;;; (isinstr-nest sstr (substr str 2))))))
;;; (setq a (isinstr-nest sstr str))
;;; ;; if there is a good result... otherwise...
;;; (if a (1+ (- (strlen str) (strlen a))) nil))
;;;-------------------------------------------------------------------;
;;; ver 0.2 ;
;;;-------------------------------------------------------------------;
(defun instr? (sstr str c-sen / a)
(cond ((eq c-sen nil) (setq sstr (strcase sstr))
(setq str (strcase str))))
;; if the user wants case sensivity then set the str's
;; case to upper, otherwise dont evaluate (less steps)
(defun instr-nest (sstr str)
(cond ((> (strlen str) 0)
;; If there is still more string to search
(if (eq sstr (substr str 1 (strlen sstr)))
;; Check the substring with a part of the string
;; to see if they match if they do...
str ; Return the string
(instr-nest sstr (substr str 2)))))) ; go thur again
(setq a (instr-nest sstr str)) ; Set a variable for testing
;; if there is a good result... otherwise...
(if a (1+ (- (strlen str) (strlen a))) nil))
;; Take a given string and strip it to the point where you want it to.
;; Pass the last charater you want removed from the string.
;; e.g. (StringStrip-Begining "This is a test" "i")
;; -> "s a test"
(defun StringStrip-Begining (Str Char)
(defun ListStriper (lst dec)
(if (= (car lst) dec)
(cdr lst) (ListStriper (cdr lst) dec)))
(cond ((wcmatch str (strcat "*"char"*"))
(vl-List->String
(ListStriper
(StrList->DecList
(String->StrList str)) (ascii Char))))))
;;; ;
;;; e.g. (StringStrip-End "This is a test" "i")
;;; -> "This "
(defun StringStrip-End (Str Char)
(defun ListStriper (lst dec)
(if (= (car lst) dec)
(cdr lst) (ListStriper (cdr lst) dec)))
(cond ((wcmatch str (strcat "*"char"*"))
(vl-List->String
(reverse
(ListStriper
(reverse
(StrList->AsciiList
(String->StrList str))) (ascii Char)))))))