Skip to content
Jay Shah edited this page Nov 6, 2015 · 24 revisions

Below is the quick reference for all function this library has.

Utility functions

randFromRangeArb(min, max)            // Returns a random number between min (inclusive) and max (exclusive)
randFromRange(min, max)               // Returns a random integer between min (inclusive) and max (inclusive)

String functions

str.chr(065)                          // Returns a character from the specified ASCII value.
str.lcfirst()                         // Convert first letter to lower case of a string
str.ucfirst()                         // Convert first letter to upper case of a string
str.cmp('secondStr')                  // Compares two strings
str.pad('PadString', 2, 'RIGHT')      // Pad a string with the characters that are given as arguments
str.repeat(5)                         // Repeats a specific string till 'len' number of times
str.ucwords()                         // Upper case first letter of the word.
str.htmlspecialchars()                // Convert special characters to HTML entities
str.html_entities_decode()            // Converts html entities to characters
str.reverse()                         // Reverse the string
str.rtrim('c')                        // Trims specified character from the end of th string, by default removes space
str.ltrim()                           // Trims specified character from the beginning of the string, by default removes space
str.strstr('needle',true)             // Returns string after the given string if bool is false else returns string before the given string.
str.chunk_split('10','char')          // Split a string into smaller chunks.
str.shuffle()                         // Returns shuffled string
str.nl2br()                           // Returns string with '<br />' or '<br>' inserted before all newlines 
str.substr_replace('StrReplace', 0 , 12)  // Replaces a part of a string with another string.

Array functions

arr.unique()                      // Get unique elements from one dimensional array
arr.has_duplicates()              // Returns True/False if array has duplicate element
arr.has_duplicates_assoc('phone') // Returns True/False if associative array has duplicate element based on key provided
arr.duplicates()                  // Returns object containing duplicate elements with their occurrences
arr.duplicates_assoc('phone')     // Returns object same as above but for associative array
arr.indexOfAssoc('value', 'key')  // Find first index of a value based on key for associative array
arr.lastIndexOfAssoc('value','key')  // Find last index of a value based on key for associative array
Clone this wiki locally