Package Home

Zend Framework 2 Documentation (Manual)

PHK Home

File: /_sources/modules/zend.filter.word.separator-to-separator.txt

Size:1181
Storage flags:no_autoload,compress/gzip (37%)

.. _zend.filter.set.separatortoseparator:

SeparatorToSeparator
--------------------

This filter modifies a given string such that 'words with separators' are converted to 'words-with-separators'.

.. _zend.filter.set.separatortoseparator.options:

Supported Options
^^^^^^^^^^^^^^^^^

The following options are supported for ``Zend\Filter\Word\SeparatorToSeparator``:

- **searchSeparator**: The search separator char. If this is not set the separator will be a space character.

- **replaceSeparator**: The replace separator char. If this is not set the separator will be a dash.

.. _zend.filter.set.separatortoseparator.basic:

Basic Usage
^^^^^^^^^^^

A basic example of usage is below:

.. code-block:: php
   :linenos:

   $filter = new Zend\Filter\Word\SeparatorToSeparator(':', '+');

   print $filter->filter('this:is:my:content');

The above example returns 'this+is+my+content'.

.. _zend.filter.set.separatortoseparator.default-behavior:

Default Behaviour
^^^^^^^^^^^^^^^^^

.. code-block:: php
   :linenos:

   $filter = new Zend\Filter\Word\SeparatorToSeparator();

   print $filter->filter('this is my content');

The above example returns 'this-is-my-content'.


For more information about the PHK package format: http://phk.tekwire.net