Warning, /sdk/kde-dev-scripts/kde-emacs/kdab-qstring.el is written in an unsupported language. File is not indexed.

0001 ;; Strings are just the most annoying things in Lisp, so this file will
0002 ;; contain some of the well known string functions from QString
0003 
0004 (defun string-startsWith (fullstring substring)
0005   (and
0006    ( >= (length fullstring) (length substring))
0007    (string= (substring fullstring 0 (length substring)) substring)))
0008 
0009 (defun string-endsWith (fullstring substring)
0010   (string= (substring fullstring (- (length fullstring) (length substring))) substring))
0011 
0012 (defun string-indexOf-regexp (fullstring regexp) 
0013   (string-match regexp fullstring))
0014 
0015 (defun string-left (string count)
0016   (if (> count (length string))
0017       string
0018     (substring string 0 count)))
0019 
0020 (defun string-mid (string start &optional count)
0021   (if count
0022       (substring string start (+ start count))
0023   (substring string start)))
0024 
0025 (defun string-right (string count)
0026   (if (> count (length string))
0027       string
0028     (substring string (- 0 count))))
0029 
0030 
0031 (defun stringlist-contains (list str)
0032   (let (elm (more 't) (res 'nil))
0033     (while (and more list)
0034       (if (symbolp (car list))
0035           (if (eq (car list) (intern str))
0036               (progn
0037                 (setq more nil)
0038                 (setq res 't)))
0039         (if (string= (car list) str)
0040               (progn
0041                 (setq more nil)
0042                 (setq res 't))))
0043       (setq list (cdr list)))
0044     res))
0045 
0046 (defun stringlist-join (list str)
0047   (mapconcat (lambda (x) x) list str))
0048 
0049 
0050 (defun string-simplified (str)
0051   (replace-in-string (replace-in-string str "^[ \t\n]+" "") "[ \t\n]+$" ""))
0052 
0053 (provide 'kdab-qstring)