nameoverflow / left-pads

Do not reinvent the wheel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

left-pad

String left pad.

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

Usage

CoffeeScript

leftpad = require './left-pad'

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

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

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

Haskell

module Main where
    import LeftPad

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

Scheme

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

PHP

<?php
include_once 'left-pad.php';
echo leftpad("foo", 6, 'f'); // => "ffffoo"
?>

About

Do not reinvent the wheel


Languages

Language:CoffeeScript 32.5%Language:Haskell 28.7%Language:Scheme 22.7%Language:PHP 16.2%