Code Monkey home page Code Monkey logo

string-utils's Introduction

Overview

String-manipulation utilities for Emacs Lisp.

string-utils

String-utils is a collection of functions for string manipulation. This library has no user-level interface; it is only useful for programming in Emacs Lisp.

The following functions are provided:

string-utils-stringify-anything
string-utils-has-darkspace-p
string-utils-has-whitespace-p
string-utils-trim-whitespace
string-utils-compress-whitespace
string-utils-string-repeat
string-utils-escape-double-quotes
string-utils-quotemeta
string-utils-pad
string-utils-pad-list
string-utils-propertize-fillin

The most complex function is string-utils-pad, the docstring for which is reproduced below:

(string-utils-pad STR-VAL WIDTH &optional MODE CHAR THROW-ERROR)

Pad STR-VAL to WIDTH.

Optional MODE defaults to 'right, but may be 'left, 'center, or an integer.

When MODE is 'left, padding characters are prepended. When MODE is 'center, padding characters are both appended and prepended so that STR-VAL is centered within WIDTH.

When MODE is a positive integer, the behavior is fixed-position padding. Similar to 'center, padding may be added on the right and on the left. Exactly MODE-many padding characters are added on the left before padding to the full WIDTH on the right. When MODE is a negative integer, the behavior is the same, except that MODE fixes the right-side padding.

Optional CHAR sets the padding character (defaults to space).

Optional THROW-ERROR throws an error if the length of STR-VAL already exceeds WIDTH, or if the fixed-position padding requested would cause the result to exceed WIDTH. When THROW-ERROR is not set (the default), a best-attempt result is always returned.

Tabs are expanded to spaces according to the value of tab-width.

Returns a padded copy of string STR-VAL.

Compatibility and Requirements

Tested only on GNU Emacs version 24.1

No external dependencies

string-utils's People

Contributors

rolandwalker avatar

Watchers

Rolando Pereira avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.