summary refs log tree commit diff
path: root/emacs/elisp/my-strings.el
blob: 40ad888e5e8112d549f78593e1a7b08809edf732 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
;;; my-strings.el --- Functions related to strings manipulation
;;; Commentary:
;;; Code:

(defun my/remove-sql-columns ()
  "Remove \"|\" from strings.
This is useful when I want to drop the column separator from some
text coming from a mysql query."
  (interactive)
  (while (search-forward-regexp "\s?|\s?")
    (replace-match " ")))

;; from https://karl-voit.at/2014/08/10/bookmarks-with-orgmode/
(defun my/string-replace (this withthat in)
  "Replace THIS with WITHTHAT' in the string IN."
  (with-temp-buffer
    (insert in)
    (goto-char (point-min))
    (replace-string this withthat)
    (buffer-substring (point-min) (point-max))))

(provide 'my-strings)
;;; my-strings.el ends here