printf

Type:Function
Status:stable
Since:1.0.0
Platform:jsnode
@blackbyte.sugar.shared.string

printf php equavalent

Params

  1. source*-String

    The source in which to replace the tokens

  2. values…*-Mixed

    Any number of arguments to replace the placeholders in the string

Return

  1. -String

    The resulting string

Example

import { printf } from '@blackbyte/sugar/string';
printf('Hello %s', 'world'); // => Hello world
printf('Hello %s, I\'m %s', 'world', 'John Doe'); // Hello world, I'm John Doe
printf('Hello %(first)s, I\'m %(name)s', { first : 'world', name : 'John Doe'}); // Hello world, I'm John Doe

Todo

  • testsnormal