HGRC Quarry Fossil Service
Simple tools for lasting software

Infrastructure as a Service / Nemoptera

A solid foundation to fork, tweak, and enhance.

Public | Owner: Infrastructure as a Service | Default branch: trunk | Last update: 2026-11-08 15:31

Artifact a8a2e6d07340bcd46eb42a95fad322fef8f91f2af18ab79e67464643fee235b1:


(defmodule nemoptera_text
  (export all))

(defun to-str (value)
  (cond
    ((is_binary value) (binary_to_list value))
    ((is_integer value) (integer_to_list value))
    ((is_list value) value)
    ((or (=:= value 'undefined) (=:= value 'null) (=:= value 'nil) (=:= value 'none)) "")
    ((is_atom value) (atom_to_list value))
    ('true (lists:flatten (io_lib:format "~p" (list value))))))

(defun blank? (value)
  (=:= "" (string:trim (to-str value))))

(defun now-iso ()
  (calendar:system_time_to_rfc3339 (os:system_time 'second)
                                    (list (tuple 'unit 'second))))

(defun sql-quote (value)
  (string:replace (to-str value) "'" "''" 'all))

(defun clip (value limit)
  (let ((s (to-str value)))
    (if (> (length s) limit)
        (lists:sublist s limit)
        s)))

(defun to-int (value default)
  (case (catch (list_to_integer (string:trim (to-str value))))
    (n (if (is_integer n) n default))
    (_ default)))

Clone

You can clone this repository with the following command:

fossil clone https://hgrc.dev/IaaS/Nemoptera Nemoptera.fossil

Contribute

The best way to contribute is through e-mail. See the project documentation for more details.