Ignore:
Timestamp:
03/13/03 03:14:52 (18 years ago)
Author:
piso
Message:

String comparison functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/strings.lisp

    r1119 r1237  
    22;;;
    33;;; Copyright (C) 2003 Peter Graves
    4 ;;; $Id: strings.lisp,v 1.1 2003-03-07 19:22:14 piso Exp $
     4;;; $Id: strings.lisp,v 1.2 2003-03-13 03:14:52 piso Exp $
    55;;;
    66;;; This program is free software; you can redistribute it and/or
     
    2020(in-package "COMMON-LISP")
    2121
    22 (export '(string-upcase string-downcase))
     22(export '(string-upcase string-downcase
     23          string= string/= string-equal string-not-equal
     24          string< string>
     25          string<= string>=
     26          string-lessp string-greaterp
     27          string-not-lessp string-not-greaterp))
    2328
    2429(defun string-upcase (string &key (start 0) end)
     
    2732(defun string-downcase (string &key (start 0) end)
    2833  (%string-downcase string start end))
     34
     35(defun string= (string1 string2 &key (start1 0) end1 (start2 0) end2)
     36  (let* ((string1 (string string1))
     37         (string2 (string string2))
     38         (end1 (or end1 (length string1)))
     39         (end2 (or end2 (length string2))))
     40    (%string= string1 string2 start1 end1 start2 end2)))
     41
     42(defun string/= (string1 string2 &key (start1 0) end1 (start2 0) end2)
     43  (let* ((string1 (string string1))
     44         (string2 (string string2))
     45         (end1 (or end1 (length string1)))
     46         (end2 (or end2 (length string2))))
     47    (%string/= string1 string2 start1 end1 start2 end2)))
     48
     49(defun string-equal (string1 string2 &key (start1 0) end1 (start2 0) end2)
     50  (let* ((string1 (string string1))
     51         (string2 (string string2))
     52         (end1 (or end1 (length string1)))
     53         (end2 (or end2 (length string2))))
     54    (%string-equal string1 string2 start1 end1 start2 end2)))
     55
     56(defun string-not-equal (string1 string2 &key (start1 0) end1 (start2 0) end2)
     57  (let* ((string1 (string string1))
     58         (string2 (string string2))
     59         (end1 (or end1 (length string1)))
     60         (end2 (or end2 (length string2))))
     61    (%string-not-equal string1 string2 start1 end1 start2 end2)))
     62
     63(defun string< (string1 string2 &key (start1 0) end1 (start2 0) end2)
     64  (let* ((string1 (string string1))
     65         (string2 (string string2))
     66         (end1 (or end1 (length string1)))
     67         (end2 (or end2 (length string2))))
     68    (%string< string1 string2 start1 end1 start2 end2)))
     69
     70(defun string> (string1 string2 &key (start1 0) end1 (start2 0) end2)
     71  (let* ((string1 (string string1))
     72         (string2 (string string2))
     73         (end1 (or end1 (length string1)))
     74         (end2 (or end2 (length string2))))
     75    (%string> string1 string2 start1 end1 start2 end2)))
     76
     77(defun string<= (string1 string2 &key (start1 0) end1 (start2 0) end2)
     78  (let* ((string1 (string string1))
     79         (string2 (string string2))
     80         (end1 (or end1 (length string1)))
     81         (end2 (or end2 (length string2))))
     82    (%string<= string1 string2 start1 end1 start2 end2)))
     83
     84(defun string>= (string1 string2 &key (start1 0) end1 (start2 0) end2)
     85  (let* ((string1 (string string1))
     86         (string2 (string string2))
     87         (end1 (or end1 (length string1)))
     88         (end2 (or end2 (length string2))))
     89    (%string>= string1 string2 start1 end1 start2 end2)))
     90
     91(defun string-lessp (string1 string2 &key (start1 0) end1 (start2 0) end2)
     92  (let* ((string1 (string string1))
     93         (string2 (string string2))
     94         (end1 (or end1 (length string1)))
     95         (end2 (or end2 (length string2))))
     96    (%string-lessp string1 string2 start1 end1 start2 end2)))
     97
     98(defun string-greaterp (string1 string2 &key (start1 0) end1 (start2 0) end2)
     99  (let* ((string1 (string string1))
     100         (string2 (string string2))
     101         (end1 (or end1 (length string1)))
     102         (end2 (or end2 (length string2))))
     103    (%string-greaterp string1 string2 start1 end1 start2 end2)))
     104
     105(defun string-not-lessp (string1 string2 &key (start1 0) end1 (start2 0) end2)
     106  (let* ((string1 (string string1))
     107         (string2 (string string2))
     108         (end1 (or end1 (length string1)))
     109         (end2 (or end2 (length string2))))
     110    (%string-not-lessp string1 string2 start1 end1 start2 end2)))
     111
     112(defun string-not-greaterp (string1 string2 &key (start1 0) end1 (start2 0) end2)
     113  (let* ((string1 (string string1))
     114         (string2 (string string2))
     115         (end1 (or end1 (length string1)))
     116         (end2 (or end2 (length string2))))
     117    (%string-not-greaterp string1 string2 start1 end1 start2 end2)))
Note: See TracChangeset for help on using the changeset viewer.