Zikula: A Flexible Open Source Content Management System
home | forum | international support | contact us

Docs For Class StringUtil

Class: StringUtil

Source Location: /pnobjlib/StringUtil.class.php

Class Overview


StringUtil

Methods


Inherited Variables

Inherited Methods


Class Details

[line 20] StringUtil



[ Top ]

Class Methods


method countInstances [line 33]

The countInstances( haystack $haystack, needle $needle)

Count the instances of needle in the given string

Why is this function here? PHP has a builtin substr_count() to do the same.




Tags:

return:  numer of instances of needle in string


Parameters:

haystack   $haystack   the string to search
needle   $needle   the needle to search for and count

[ Top ]

method getTruncatedString [line 48]

The getTruncatedString( string $string, [limit $limit = 80], [appendDots $appendDots = true])

Truncate a string to a certain length



Tags:

return:  potentially truncated string


Parameters:

string   $string   the string to operate on
limit   $limit   the maximum number of characters displayed (optional) (default=80)
appendDots   $appendDots   whether or not to append '...' to the maximum number of characters displayed (optional) (default=80)

[ Top ]

method highlightWords [line 152]

void highlightWords( $text, $wordStr, [ $contextSize = 200])





Parameters:

   $text  
   $wordStr  
   $contextSize  

[ Top ]

method left [line 124]

a left( string $string, left $left)

Returns the left x chars of a string. If the string is longer than x, the whole string is returned



Tags:

return:  part of the supplied string


Parameters:

string   $string   the string to operate on
left   $left   the number of chars to return

[ Top ]

method nl2html [line 73]

The nl2html( string $string)

Translate html input newlines to
sequences.

This function is necessary as inputted strings will contain "\n\r" instead of just "\n"




Tags:

return:  converted string


Parameters:

string   $string   the string to operate on

[ Top ]

method right [line 142]

a right( string $string, right $right)

Returns the right x chars of a string. If the string is longer than x, the whole string is returned



Tags:

return:  part of the supplied string


Parameters:

string   $string   the string to operate on
right   $right   the number of chars to return

[ Top ]

method stripos [line 108]

The stripos( haystack $haystack, needle $needle, offset $offset)

Case-Insensitive version of strpos (standard only available in PHP 5)



Tags:

return:  token array


Parameters:

haystack   $haystack   the string to search
needle   $needle   the string to search for
offset   $offset   the search start offset position (optional) (default=0)

[ Top ]

method tokenize [line 92]

The tokenize( string $string, delimeter $delimeter, [max $max = 999999])

Tokenize a string according to the given parameters.

This function just wraps explode to provide a more java-similar syntax




Tags:

return:  token array


Parameters:

string   $string   the string to tokenize
delimeter   $delimeter   the delimeter to use
max   $max   the maximal number of tokens to generate (optional) (default=999999)

[ Top ]

Packages:

Files:

Classes: