![]() ![]() ‘:prefix‘ and ‘:suffix‘: if both are supplied and non-nil, call ‘str:ensure-suffix‘ followed by ‘str:ensure-prefix‘. This checks that ‘s‘ both starts and ends with the supplied string or character. ‘:wrapped-in‘: if non nil, call ‘str:ensure-wrapped-in‘. This ‘str:ensure‘ function looks for the following key parameters, in order: The "ensure-" functions return a string that has the specified prefix or suffix, appended if necessary. # ensure ‘(s &key wrapped-in prefix suffix)‘ NEW in March, 2023 Join strings in list ‘list-of-strings‘ with ‘separator‘ (either a string or a char) in between. Where whitespaces are ‘’(#\Space #\Newline #\Backspace #\Tab #\Linefeed #\Page #\Return #\Rubout)‘.Įnsure there is only one space character between words. If supplied, ‘char-bag‘ has to be a sequence (e.g. Removes all characters in ‘char-bag‘ (default: whitespaces) at the beginning and end of ‘s‘. # trim ‘(s &key (char-bag *whitespaces*))‘ (str:ends-with-p "BAR" "foobar" :ignore-case t) Some parameters are common to various functions and often used:Ĭonsequently we can also manage them with global parameters: Multiplatform development environment shipping Emacs, Quicklisp, SBCL Of QL as Debian’s apt rather than pip/npm/etc):ĭon’t have a full Common Lisp development environment yet ? Get To get a newer version, you need to update the Quicklisp dist (think It is not recommended to ‘:use :str‘ in a package. asd’s project dependencies, and call functions with the ‘str‘ prefix. (#count-substring-substring-s-key-start-end) (#prefix-list-of-strings-renamed-in-09) (#remove-punctuation-s-key-replacement) (#has-alpha-p-has-letters-p-has-alphanum-p-s) (#downcase-upcase-capitalize-s-fixing-a-built-in-suprise) (#functions-to-change-case-camel-case-snake-case) (#s-member-list-s-key-ignore-case-ignore-case-test-string) (#containsp-substring-s-key-ignore-case-nil) ![]() (#starts-with-p-start-s-key-ignore-case) (#split-separator-s-key-omit-nulls-limit-start-end) ![]() (#ensure-prefix-ensure-suffix-startend-s-new-in-march-2023) (#ensure-s-key-wrapped-in-prefix-suffix-new-in-march-2023) (#a-modern-and-consistent-common-lisp-string-manipulation-library) * fixing built-in surprises: ‘(string-downcase nil‘) => ‘"nil"‘ the string, whereas ‘(str:downcase nil)‘ => ‘nil‘. * consistence and composability, where ‘s‘ is always the last argument, which makes it ![]() Or ‘str:concat strings‘ instead of an unusual ‘format‘ construct one discoverable library instead of many ‘(str:trim s)‘ instead of ‘(string-trim ’(#\Backspace #\Tab #\Linefeed #\Newline #\Vt #\Page #\Return #\Space #\Rubout #\Next-Line #\No-break_space) s))‘, * modernity, simplicity and discoverability: # A modern and consistent Common Lisp string manipulation library Modern, consistent and terse Common Lisp string manipulation library. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |