Source for file String.php
Documentation is available at String.php
- 1: <?php
- 3: /**
- 4: * Nette Framework
- 5: *
- 6: * Copyright (c) 2004, 2009 David Grudl (http://davidgrudl.com)
- 7: *
- 8: * This source file is subject to the "Nette license" that is bundled
- 9: * with this package in the file license.txt.
- 10: *
- 11: * For more information please see http://nettephp.com
- 12: *
- 18: */
- 22: /**
- 23: * String tools library.
- 24: *
- 28: */
- 30: {
- 32: /**
- 33: * Static class - cannot be instantiated.
- 34: */
- 36: {
- 38: }
- 42: /**
- 43: * Checks if the string is valid for the specified encoding.
- 47: */
- 49: {
- 51: }
- 55: /**
- 56: * Returns correctly encoded string.
- 60: */
- 62: {
- 63: // removes xD800-xDFFF, xFEFF, xFFFF, x110000 and higher
- 65: }
- 69: /**
- 70: * Returns a specific character.
- 74: */
- 76: {
- 78: }
- 82: /**
- 83: * Starts the $haystack string with the prefix $needle?
- 87: */
- 89: {
- 91: }
- 95: /**
- 96: * Ends the $haystack string with the suffix $needle?
- 100: */
- 102: {
- 104: }
- 108: /**
- 109: * Removes special controls characters and normalizes line endings and spaces.
- 112: */
- 114: {
- 115: // standardize line endings to unix-like
- 119: // remove control characters; leave \t + \n
- 122: // right trim
- 125: // trailing spaces
- 129: }
- 133: /**
- 134: * Converts to web safe characters [a-z0-9-] text.
- 139: */
- 141: {
- 146: ."\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf8\xf9\xfa\xfb\xfc\xfd\xfe",
- 150: }
- 156: }
- 160: /**
- 161: * Truncates string to maximal length.
- 166: */
- 168: {
- 179: }
- 180: }
- 182: }
- 186: /**
- 187: * Indents the content from the left.
- 192: */
- 194: {
- 195: return $level < 1 ? $s : preg_replace('#(?:^|[\r\n]+)(?=[^\r\n])#', '$0' . str_repeat($chars, $level), $s);
- 196: }
- 200: /**
- 201: * Convert to lower case.
- 204: */
- 206: {
- 208: }
- 212: /**
- 213: * Convert to upper case.
- 216: */
- 218: {
- 220: }
- 224: /**
- 225: * Capitalize string.
- 228: */
- 230: {
- 232: }
- 236: /**
- 237: * Strips whitespace.
- 241: */
- 243: {
- 246: }
- 248: }