Code Monkey home page Code Monkey logo

clformat's Introduction

At attempt to recreate the Common Lisp Format function in a Rust macro.

Supported directives

Directive Description Supported
~A Prints an argument in a human-readable form. Prints Display. Yes
~S Prints an argument in a machine-readable form. Quotes strings. Yes
~% Inserts a newline character. Yes
~& Performs a "fresh-line" operation, moving to a new line if not already at the beginning of one. No
~~ Prints a tilde (~). No
~D Prints an integer in decimal format. Yes
~X Prints an integer in hexadecimal format. No
~O Prints an integer in octal format. No
~B Prints an integer in binary format. No
~F Prints a floating-point number in fixed-format. Partial
~E Prints a floating-point number in exponential format. No
~G Prints a floating-point number in either fixed-format or exponential format, depending on its value. No
~C Prints a character. No
~P Prints "s" if its argument is plural (i.e., not equal to 1); otherwise, prints nothing. No
~R Prints an integer in English words or as per other specified radix. No
~T Inserts horizontal tabulation (space padding) to align output. No
~<...~> Justifies the enclosed text according to specified parameters. Yes
~[...~] Conditional expression with multiple clauses for case selection. No
~{...~} Iterates over a list, applying formatting directives to each element. Yes
~^ Exits the closest enclosing iteration or conditional expression if no more arguments are available. Yes
~* Consumes an argument without printing it. Useful for skipping arguments. Yes
~I Indents to a specified column, potentially creating new lines if required. No
~_ Conditional newline: inserts a newline character if not at the beginning of a line. No
~W Prints an argument using "write" semantics, similar to ~S but with more control over the output. No
~M Prints an integer in Roman numerals. No
~N Alias for ~%, inserting a newline. Similar in use to ~% but rare. No
~; Separates clauses in conditional expressions (~[...~]). No
~? Embeds a recursive format operation, allowing a nested format string and arguments. No

clformat's People

Contributors

stephenwakely avatar

Watchers

 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.