From: Kevin M. Rosenberg Date: Tue, 29 Apr 2003 00:49:09 +0000 (+0000) Subject: r4671: Auto commit for Debian build X-Git-Tag: v1.96~258 X-Git-Url: http://git.kpe.io/?p=kmrcl.git;a=commitdiff_plain;h=4f21397f1d96da80fbac6f587cb384e56208b497 r4671: Auto commit for Debian build --- diff --git a/package.lisp b/package.lisp index d53fa61..88c5a51 100644 --- a/package.lisp +++ b/package.lisp @@ -7,7 +7,7 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Apr 2000 ;;;; -;;;; $Id: package.lisp,v 1.22 2003/04/29 00:23:21 kevin Exp $ +;;;; $Id: package.lisp,v 1.23 2003/04/29 00:49:09 kevin Exp $ ;;;; ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; @@ -80,6 +80,7 @@ #:count-string-words #:substitute-string-for-char #:string-trim-last-character + #:nstring-trim-last-character #:string-hash #:string-not-null? #:whitespace? diff --git a/strings.lisp b/strings.lisp index 91e5198..975f1e2 100644 --- a/strings.lisp +++ b/strings.lisp @@ -7,7 +7,7 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Apr 2000 ;;;; -;;;; $Id: strings.lisp,v 1.13 2003/04/29 00:46:35 kevin Exp $ +;;;; $Id: strings.lisp,v 1.14 2003/04/29 00:49:09 kevin Exp $ ;;;; ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; @@ -115,6 +115,13 @@ (subseq s 0 (1- len)) s))) +(defun nstring-trim-last-character (s) + "Return the string less the last character" + (let ((len (length s))) + (if (plusp len) + (nsubseq s 0 (1- len)) + s))) + (defun string-hash (str &optional (bitmask 65535)) (let ((hash 0)) (declare (fixnum hash) diff --git a/tests.lisp b/tests.lisp index f4b3ce0..56eb2a5 100644 --- a/tests.lisp +++ b/tests.lisp @@ -7,7 +7,7 @@ ;;;; Author: Kevin M. Rosenberg ;;;; Date Started: Apr 2003 ;;;; -;;;; $Id: tests.lisp,v 1.3 2003/04/29 00:23:21 kevin Exp $ +;;;; $Id: tests.lisp,v 1.4 2003/04/29 00:49:09 kevin Exp $ ;;;; ;;;; This file is Copyright (c) 2000-2002 by Kevin M. Rosenberg ;;;; @@ -42,6 +42,12 @@ (deftest str.9 (escape-xml-string "ab&cd") "ab&cd") (deftest str.10 (escape-xml-string "ab&cd<") "ab&cd<") (deftest str.11 (escape-xml-string "ab&c><") "ab&c><") +(deftest str.12 (string-trim-last-character "") "") +(deftest str.13 (string-trim-last-character "a") "") +(deftest str.14 (string-trim-last-character "ab") "a") +(deftest str.15 (nstring-trim-last-character "") "") +(deftest str.16 (nstring-trim-last-character "a") "") +(deftest str.17 (nstring-trim-last-character "ab") "a") #+kmrtest-mop (progn