Git Product home page Git Product logo

format's Introduction

Format Class

This class was developed to hold static formatting helper methods as outlined below...

Getting Started

Prerequisites

  • PHP 7.1 or greater (due to type hinting)

INSTALLING

Via Composer

Run the following command in the same directory as your composer.json file:

php composer.phar require jabarihunt/format

Via Github

  1. Clone this repository into a working directory: git clone [email protected]:jabarihunt/format
  2. Include the Format class in your project...
require('/path/to/Format.php')

...or if using an auto-loader...

 use jabarihunt/Format

USAGE

name(string $name):

Credit for the original method goes to Armand Niculescu.

This method correctly capitalizes names when there are prefixes & suffixes, apostrophes, name parts that shouldn't be capitalized, and in other scenarios where using something like ucwords(strtolower($str)) doesn't work.

Examples:

$name ucwords(strtolower($name)) Format::name($name)
michael o’carrol Michael O’carrol Michael O’Carrol
lucas l’amour Lucas L’amour Lucas l’Amour
george d’onofrio George D’onofrio George d’Onofrio
william stanley iii William Stanley Iii William Stanley III
UNITED STATES OF AMERICA United States Of America United States of America
t. von lieres und wilkau T. Von Lieres Und Wilkau T. von Lieres und Wilkau
paul van der knaap Paul Van Der Knaap Paul van der Knaap
jean-luc picard Jean-luc Picard Jean-Luc Picard
JOHN MCLAREN John Mclaren John McLaren
hENRIC vIII Henric Viii Henric VIII
VAsco da GAma Vasco Da Gama Vasco da Gama

CONTRIBUTING

  1. Fork Repository
  2. Create a descriptive branch name
  3. Make edits to your branch
  4. Squash (rebase) your commits
  5. Create a pull request

LICENSE

This project is licensed under the MIT License - see the LICENSE.md file for details.

format's People

Contributors

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