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 https://nette.org
- 12: *
- 19: */
- 23: /**
- 24: * String tools library.
- 25: *
- 29: */
- 31: {
- 33: /**
- 34: * Static class - cannot be instantiated.
- 35: */
- 37: {
- 39: }
- 43: /**
- 44: * Checks if the string is valid for the specified encoding.
- 48: */
- 50: {
- 52: }
- 56: /**
- 57: * Returns correctly encoded string.
- 61: */
- 63: {
- 64: // removes xD800-xDFFF, xFEFF, xFFFF, x110000 and higher
- 66: }
- 70: /**
- 71: * Returns a specific character.
- 75: */
- 77: {
- 79: }
- 83: /**
- 84: * Starts the $haystack string with the prefix $needle?
- 88: */
- 90: {
- 92: }
- 96: /**
- 97: * Ends the $haystack string with the suffix $needle?
- 101: */
- 103: {
- 105: }
- 109: /**
- 110: * Removes special controls characters and normalizes line endings and spaces.
- 113: */
- 115: {
- 116: // standardize line endings to unix-like
- 120: // remove control characters; leave \t + \n
- 123: // right trim
- 126: // trailing spaces
- 130: }
- 134: /**
- 135: * 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: /**
- 238: */
- 240: {
- 241: trigger_error(__METHOD__ . '() is deprecated; use TemplateHelpers::bytes() instead.', E_USER_WARNING);
- 243: }
- 245: }