3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
10 namespace Zend\Stdlib\StringWrapper;
12 interface StringWrapperInterface
15 * Check if the given character encoding is supported by this wrapper
16 * and the character encoding to convert to is also supported.
18 * @param string $encoding
19 * @param string|null $convertEncoding
21 public static function isSupported($encoding, $convertEncoding = null);
24 * Get a list of supported character encodings
28 public static function getSupportedEncodings();
31 * Set character encoding working with and convert to
33 * @param string $encoding The character encoding to work with
34 * @param string|null $convertEncoding The character encoding to convert to
35 * @return StringWrapperInterface
37 public function setEncoding($encoding, $convertEncoding = null);
40 * Get the defined character encoding to work with (upper case)
44 public function getEncoding();
47 * Get the defined character encoding to convert to (upper case)
51 public function getConvertEncoding();
54 * Returns the length of the given string
59 public function strlen($str);
62 * Returns the portion of string specified by the start and length parameters
66 * @param int|null $length
67 * @return string|false
69 public function substr($str, $offset = 0, $length = null);
72 * Find the position of the first occurrence of a substring in a string
74 * @param string $haystack
75 * @param string $needle
79 public function strpos($haystack, $needle, $offset = 0);
82 * Convert a string from defined encoding to the defined convert encoding
85 * @param bool $reverse
86 * @return string|false
88 public function convert($str, $reverse = false);
91 * Wraps a string to a given number of characters
95 * @param string $break
99 public function wordWrap($str, $width = 75, $break = "\n", $cut = false);
102 * Pad a string to a certain length with another string
104 * @param string $input
105 * @param int $padLength
106 * @param string $padString
107 * @param int $padType
110 public function strPad($input, $padLength, $padString = ' ', $padType = STR_PAD_RIGHT);