[ Index ]

PHP Cross Reference of MyBB 1.8.38

title

Body

[close]

/inc/3rdparty/diff/Diff/ -> String.php (summary)

Provides static methods for charset and locale safe string manipulation.

Author: Jan Schneider <jan@horde.org>
License: http://www.horde.org/licenses/lgpl21 LGPL 2.1
File Size: 924 lines (32 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Horde_String:: (26 methods):
  convertCharset()
  _convertCharset()
  lower()
  upper()
  ucfirst()
  ucwords()
  substr()
  length()
  pos()
  ipos()
  rpos()
  ripos()
  _pos()
  pad()
  wordwrap()
  wrap()
  truncate()
  abbreviate()
  common()
  isAlpha()
  isLower()
  isUpper()
  regexMatch()
  validUtf8()
  _mbstringCharset()
  trimUtf8Bom()


Class: Horde_String  - X-Ref

convertCharset($input, $from, $to, $force = false)   X-Ref
Converts a string from one charset to another.
Uses the iconv or the mbstring extensions.
The original string is returned if conversion failed or none
of the extensions were available.return: mixed  The converted input data.
param: mixed $input    The data to be converted. If $input is an an
param: string $from    The string's current charset.
param: string $to      The charset to convert the string to.
param: boolean $force  Force conversion?

_convertCharset($input, $from, $to)   X-Ref
Internal function used to do charset conversion.
return: string  The converted string.
param: string $input  See self::convertCharset().
param: string $from   See self::convertCharset().
param: string $to     See self::convertCharset().

lower($string, $locale = false, $charset = null)   X-Ref
Makes a string lowercase.
return: string  The string with lowercase characters.
param: string $string   The string to be converted.
param: boolean $locale  If true the string will be converted based on
param: string $charset  If $locale is true, the charset to use when

upper($string, $locale = false, $charset = null)   X-Ref
Makes a string uppercase.
return: string  The string with uppercase characters.
param: string $string   The string to be converted.
param: boolean $locale  If true the string will be converted based on a
param: string $charset  If $locale is true, the charset to use when

ucfirst($string, $locale = false, $charset = null)   X-Ref
Returns a string with the first letter capitalized if it is
alphabetic.

return: string  The capitalized string.
param: string $string   The string to be capitalized.
param: boolean $locale  If true the string will be converted based on a
param: string $charset  The charset to use, defaults to current charset.

ucwords($string, $locale = false, $charset = null)   X-Ref
Returns a string with the first letter of each word capitalized if it is
alphabetic.

Sentences are splitted into words at whitestrings.return: string  The capitalized string.
param: string $string   The string to be capitalized.
param: boolean $locale  If true the string will be converted based on a
param: string $charset  The charset to use, defaults to current charset.

substr($string, $start, $length = null,$charset = 'UTF-8')   X-Ref
Returns part of a string.
return: string  The string's part.
param: string $string   The string to be converted.
param: integer $start   The part's start position, zero based.
param: integer $length  The part's length.
param: string $charset  The charset to use when calculating the part's

length($string, $charset = 'UTF-8')   X-Ref
Returns the character (not byte) length of a string.
return: integer  The string's length.
param: string $string  The string to return the length of.
param: string $charset The charset to use when calculating the string's

pos($haystack, $needle, $offset = 0, $charset = 'UTF-8')   X-Ref
Returns the numeric position of the first occurrence of $needle
in the $haystack string.

return: integer  The position of first occurrence.
param: string $haystack  The string to search through.
param: string $needle    The string to search for.
param: integer $offset   Character in $haystack to start searching at.
param: string $charset   Charset of $needle.

ipos($haystack, $needle, $offset = 0, $charset = 'UTF-8')   X-Ref
Returns the numeric position of the first case-insensitive occurrence
of $needle in the $haystack string.

return: integer  The position of first case-insensitive occurrence.
param: string $haystack  The string to search through.
param: string $needle    The string to search for.
param: integer $offset   Character in $haystack to start searching at.
param: string $charset   Charset of $needle.

rpos($haystack, $needle, $offset = 0, $charset = 'UTF-8')   X-Ref
Returns the numeric position of the last occurrence of $needle
in the $haystack string.

return: integer  The position of last occurrence.
param: string $haystack  The string to search through.
param: string $needle    The string to search for.
param: integer $offset   Character in $haystack to start searching at.
param: string $charset   Charset of $needle.

ripos($haystack, $needle, $offset = 0, $charset = 'UTF-8')   X-Ref
Returns the numeric position of the last case-insensitive occurrence of
$needle in the $haystack string.

return: integer  The position of last case-insensitive occurrence.
param: string $haystack  The string to search through.
param: string $needle    The string to search for.
param: integer $offset   Character in $haystack to start searching at.
param: string $charset   Charset of $needle.

_pos($haystack, $needle, $offset, $charset, $func)   X-Ref
Perform string position searches.
return: integer  The position of occurrence.
param: string $haystack  The string to search through.
param: string $needle    The string to search for.
param: integer $offset   Character in $haystack to start searching at.
param: string $charset   Charset of $needle.
param: string $func      Function to use.

pad($input, $length, $pad = ' ',$type = STR_PAD_RIGHT, $charset = 'UTF-8')   X-Ref
Returns a string padded to a certain length with another string.
This method behaves exactly like str_pad() but is multibyte safe.

return: string  The padded string.
param: string $input    The string to be padded.
param: integer $length  The length of the resulting string.
param: string $pad      The string to pad the input string with. Must
param: const $type      The padding type. One of STR_PAD_LEFT,
param: string $charset  The charset of the input and the padding

wordwrap($string, $width = 75, $break = "\n",$cut = false, $line_folding = false)   X-Ref
Wraps the text of a message.
return: string  String containing the wrapped text.
param: string $string         String containing the text to wrap.
param: integer $width         Wrap the string at this number of
param: string $break          Character(s) to use when breaking lines.
param: boolean $cut           Whether to cut inside words if a line
param: boolean $line_folding  Whether to apply line folding rules per

wrap($text, $length = 80, $break_char = "\n",$quote = false)   X-Ref
Wraps the text of a message.
return: string  String containing the wrapped text.
param: string $text        String containing the text to wrap.
param: integer $length     Wrap $text at this number of characters.
param: string $break_char  Character(s) to use when breaking lines.
param: boolean $quote      Ignore lines that are wrapped with the '>'

truncate($text, $length = 100)   X-Ref
Return a truncated string, suitable for notifications.
return: string  The truncated string, if longer than $length.
param: string $text     The original string.
param: integer $length  The maximum length.

abbreviate($text, $length = 20)   X-Ref
Return an abbreviated string, with characters in the middle of the
excessively long string replaced by '...'.

return: string  The abbreviated string, if longer than $length.
param: string $text     The original string.
param: integer $length  The length at which to abbreviate.

common($str1, $str2)   X-Ref
Returns the common leading part of two strings.
return: string  The start of $str1 and $str2 that is identical in both.
param: string $str1  A string.
param: string $str2  Another string.

isAlpha($string, $charset)   X-Ref
Returns true if the every character in the parameter is an alphabetic
character.

return: boolean  True if the parameter was alphabetic only.
param: string $string   The string to test.
param: string $charset  The charset to use when testing the string.

isLower($string, $charset)   X-Ref
Returns true if ever character in the parameter is a lowercase letter in
the current locale.

return: boolean  True if the parameter was lowercase.
param: string $string   The string to test.
param: string $charset  The charset to use when testing the string.

isUpper($string, $charset)   X-Ref
Returns true if every character in the parameter is an uppercase letter
in the current locale.

return: boolean  True if the parameter was uppercase.
param: string $string   The string to test.
param: string $charset  The charset to use when testing the string.

regexMatch($text, $regex, $charset = null)   X-Ref
Performs a multibyte safe regex match search on the text provided.
return: array  The matches array from the first regex that matches.
param: string $text     The text to search.
param: array $regex     The regular expressions to use, without perl
param: string $charset  The character set of the text.

validUtf8($text)   X-Ref
Check to see if a string is valid UTF-8.
return: boolean  True if valid UTF-8.
param: string $text  The text to check.

_mbstringCharset($charset)   X-Ref
Workaround charsets that don't work with mbstring functions.
return: string  The charset to use with mbstring functions.
param: string $charset  The original charset.

trimUtf8Bom($str)   X-Ref
Strip UTF-8 byte order mark (BOM) from string data.
return: string  Stripped string (UTF-8).
param: string $str  Input string (UTF-8).



2005 - 2021 © MyBB.de | Alle Rechte vorbehalten! | Sponsor: netcup Cross-referenced by PHPXref