Giter Club home page Giter Club logo

cslugify's Introduction

CSlugify

CSlugify is a simple slugifier implemented in C. It converts input strings into URL-friendly slugs.

Features

  • UTF-8 support
  • Character and locale-specific mappings
  • Customizable replacement characters
  • Options for case conversion, strict alphanumeric filtering, and trimming
  • Support for removal of unwanted characters

Usage

#include <stdio.h>
#include "cslugify.h"

int main() {
  const wchar_t *input = L"Hello, World!";
  char output[MAX_BUFFER_SIZE];
  SlugifyOptions options = {
                            .replacement = '-',
                            .remove = L"$*_+~.()\"'!?-:@",
                            .lower = true,
                            .strict = true,
                            .locale = NULL,
                            .trim = true
                          };
  slugify(input, output, &options);
  printf("%s\n", output); // hello-world
  return 0;
}

Slugify Options

  • replacement: Character used to replace spaces and unwanted characters.
  • remove: Set of characters to remove from the input string (default: $*_+~.()"'!?-:@).
  • lower: Convert output to lowercase.
  • strict: Remove non-alphanumeric characters.
  • locale: Locale-specific mappings to apply.
  • trim: Trim leading and trailing spaces or replacement characters.

Contributing

Contributions are welcome! Feel free to submit a pull request or open an issue for any improvements or bug fixes.

cslugify's People

Contributors

en9inerd 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.