Giter Site home page Giter Site logo

case's Introduction

case

a case conversion and detection library in zig

cases supported: camelCase, PascalCase, snake_case, CONSTANT_CASE, kebab-case, Header-Case, lower case, UPPER CASE, Capital Case

uses readers and writers throughout. supports non-allocating and comptime use.

  • to(case, reader, writer) - converts to case from reader into writer
  • of(text) - return Case of text. may be 'unknown'.
  • bufTo(buf, case, text) - writes converted text to buf in specified case
  • allocTo(allocator, case, text) - allocates a buffer and writes converted text to buffer in specified case
  • allocToZ() - same as allocTo() but null terminated
  • comptimeTo(case, text) - allocates buffer at comptime
  • comptimeToLen(case, text, len) - same as comptimeTo() but allows user to specify buffer len
  • length(case, text) - returns length needed to convert text to case
  • isCamel(text) - true if text case is camel. similar methods for each case
  • upper(reader, writer, opts), camel(reader, writer) - conversion functions for each case. upper(), lower() and capital() have an additional opts param.
  • toExt(case, reader, writer, opts) there are variants of all 'to' methods such as toExt(), lengthExt(). these are for upper, lower and capital cases when you want to specify Options.
  • opts: Options
    • fill - string used to replace non alpha numeric characters. default empty. when empty, don't replace non alpha numeric characters.
    • apostrophe - keep / remove. default keep.

c api

  • c_api.zig - exports methods similar to most public zig methods above
  • case.h
    • Case enum guaranteed to be in sync with Case enum in lib.zig

tests

$ zig build test runs the following

  • tests.zig - pretty thorough zig tests which also test the c api methods
  • test.c - a small demo program which exercises the c api

build

$ zig build

creates zig-out/lib/libcase.a and zig-out/include/case.h

  • zig package manager support

related

nbubna/Case

inspiration

thanks to cmgriffing for suggesting this

case's People

Contributors

travisstaloch avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

case's Issues

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.