# Format

### What?

Replace tokens in a string in a variety of ways

Token (string): Token (array): Token (object):

{{ sentence | format : tokens[mode] }}

    Tokens: {{ tokens[mode] | json }}

### Why?

Most commonly, this filter is helpful for internationalization. However anywhere you need to do string replacement the format filter will come in handy.

### How?

    {{ "Hello $0, how are you?" | format : 'Bob' }}
    -- or --
    $scope.tokens = ['first','second','third'];
    ...
    {{ "Are you on the $0, $1 or $2?" | format : tokens }}
    -- or --
    $scope.tokens = { name:'Bob', subject:'wife' };
    ...
    {{ "Hey :name, how's the :subject?" | format : tokens }}