Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nameoverflow/left-pads

Do not reinvent the wheel
https://github.com/nameoverflow/left-pads

Last synced: about 1 month ago
JSON representation

Do not reinvent the wheel

Awesome Lists containing this project

README

        

# left-pad

String left pad.

P.S: I will not publish it to any module platform.

## Usage

### CoffeeScript

```coffee-script
leftpad = require './left-pad'

leftpad 'foo', 5
# => " foo"

leftpad 'foobar', 6
# => "foobar"

leftpad 1, 2, 0
# => "01"
```

### Haskell

```haskell
module Main where
import LeftPad

main :: IO ()
main = putStrLn $ leftpad "foo" 6 'f'
-- => ffffoo

```

### Scheme

```scheme
(load 'left-pad.scm')
(leftpad "foo" 6 #\f) ; => "ffffoo"
```

### PHP

```php
"ffffoo"
?>
```