split by regexp and [rl]tring added

This commit is contained in:
2021-03-24 00:18:27 +01:00
parent 2c68861451
commit b0ff9dd934
7 changed files with 89 additions and 19 deletions

View File

@@ -1,33 +1,39 @@
(print (string-split "split me by space" "\\s+"))
(print (string-rtrim "abc "))
(print (string-ltrim " abc"))
(print (string-trim " abc "))
;; (print (sprintf "%.2f" (list 1.25)))
;; (print (sprintf "%.2f" '(1.23456)))
;; (print (sprintf "%d" '(10000000)))
(define q 1.23)
(print (sprintf "%+.2f%%" (list q)))
;; (define q 1.23)
;; (print (sprintf "%+.2f%%" (list q)))
(define q -1.23)
(print (sprintf "%+.2f%%" (list q)))
;; (define q -1.23)
;; (print (sprintf "%+.2f%%" (list q)))
(define term-rst-esc "\x1B[0m")
(define term-red-esc '"\x1B[31m")
(define term-green-esc "\x1B[32m")
;; (define term-rst-esc "\x1B[0m")
;; (define term-red-esc '"\x1B[31m")
;; (define term-green-esc "\x1B[32m")
(defun term-red (str) (sprintf (+ term-red-esc str term-rst-esc)))
;; (defun term-red (str) (sprintf (+ term-red-esc str term-rst-esc)))
(print (+ (term-red (sprintf "%.2f" (list 1.11))) " "
(term-green (sprintf "%.2f" (list 1.11))) " "
(term-blue (sprintf "%.2f" (list 1.11))) " "
(term-yellow (sprintf "%.2f" (list 1.11))) " "
))
;; (print (+ (term-red (sprintf "%.2f" (list 1.11))) " "
;; (term-green (sprintf "%.2f" (list 1.11))) " "
;; (term-blue (sprintf "%.2f" (list 1.11))) " "
;; (term-yellow (sprintf "%.2f" (list 1.11))) " "
;; ))
(benchmark "benchmark makelist 1000 : " (make-list 1000))
(benchmark "benchmark range 1000 : " (range 1 1000))
;; (benchmark "benchmark makelist 1000 : " (make-list 1000))
;; (benchmark "benchmark range 1000 : " (range 1 1000))
(define fdx_list (parse-csv (read-file "tests/csv_data.csv")))
(print fdx_list)
;; (define fdx_list (parse-csv (read-file "tests/csv_data.csv")))
;; (print fdx_list)
(sleep 1.5)