r4671: Auto commit for Debian build
authorKevin M. Rosenberg <kevin@rosenberg.net>
Tue, 29 Apr 2003 00:49:09 +0000 (00:49 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Tue, 29 Apr 2003 00:49:09 +0000 (00:49 +0000)
package.lisp
strings.lisp
tests.lisp

index d53fa615590d9ac4be346c25c6d7b7368ab9de07..88c5a51e4e2a46d92f1d8663a45efc82f120b69b 100644 (file)
@@ -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?
index 91e51987e8511608f40e758a4ed484e1eef863a6..975f1e2dcaad34dd1ff7b98d12ab1975a15cbdd8 100644 (file)
@@ -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
 ;;;;
        (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)
index f4b3ce079f78f95517061dcd8c4f715cdc046ec9..56eb2a574b8da402400189ada58fb748c7de53aa 100644 (file)
@@ -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
 ;;;;
 (deftest str.9 (escape-xml-string "ab&cd") "ab&amp;cd")
 (deftest str.10 (escape-xml-string "ab&cd<") "ab&amp;cd&lt;")
 (deftest str.11 (escape-xml-string "ab&c><") "ab&amp;c&gt;&lt;")
+(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