Is String Numeric
21
Proper Paragraphs
14
This function calculates how many lines will text occupy.
Example (simple):
$string = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus tincidunt posuere dolor";
$num_lines = how_many_lines(10, $string);
It accepts a third, optional, parameter $options, that allows you to change behaviour. $options should be array. Following configuration options are available:
'white_spaces' - default: array(' ', "\t") - array of chars, that should be treated as whitespace.
'new_lines' - default: array("\r\n", "\n") - array of strings, that should be treated as newlines. For example, for HTML you can set 'new_lines' => array('');
'force_line_breaks' - default: true - force wrapping, when the token is longer than width, or not. If set to false, and token cannot be fitted into $width, function will return false;
'callback' - default: null - callback function for determining character width. Must accept at least one parameter - $char
'callback_params' - default: array() - optional additional callback parameters
'char_widths' - default: null - associative array in a form $char => $width, which contains char width. If $char is not found in the array, it's width is defaulted to 0.
Example (simple):
$string = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus tincidunt posuere dolor";
$num_lines = how_many_lines(10, $string);
It accepts a third, optional, parameter $options, that allows you to change behaviour. $options should be array. Following configuration options are available:
'white_spaces' - default: array(' ', "\t") - array of chars, that should be treated as whitespace.
'new_lines' - default: array("\r\n", "\n") - array of strings, that should be treated as newlines. For example, for HTML you can set 'new_lines' => array('');
'force_line_breaks' - default: true - force wrapping, when the token is longer than width, or not. If set to false, and token cannot be fitted into $width, function will return false;
'callback' - default: null - callback function for determining character width. Must accept at least one parameter - $char
'callback_params' - default: array() - optional additional callback parameters
'char_widths' - default: null - associative array in a form $char => $width, which contains char width. If $char is not found in the array, it's width is defaulted to 0.
14
Strip HTML
13
Generate a random number or string in PHP.
12
If you have ever written a website or java application where people paste stuff in from Word, you are likely to have hit the problem of Word using high ascii chars for "open quotes", "close quotes", reg symbol, etc...
This java class (with a single static method) can replace the most prevalent of these with normal ascii values
Hope it helps someone...
This java class (with a single static method) can replace the most prevalent of these with normal ascii values
Hope it helps someone...
12
Similar to Perl's CGI::escapeHTML(), though (because we can!) this adds it as a method to all String objects.
11
Convert an irregular name=value pair string into a formatted array.
10
This simple function simply removes the character at the given index from a string.
NOTE: The count starts from 0
NOTE: The count starts from 0
10
Adds any character at the given index of a string.
NOTE: Count starts from 0
NOTE: Count starts from 0
10
template function to create a boost::shared_ptr in the form
boost::shared_ptr classPtr = new_ptr(Arg1, Arg2);
You can also make new_ptr_access a friend of className and make the constructor and destructor private.
This keeps the end user from:
Creating an instance manually on the heap
Creating an instance manually on the stack
Deleting a shared_ptr manually using "delete get()"
boost::shared_ptr classPtr = new_ptr(Arg1, Arg2);
You can also make new_ptr_access a friend of className and make the constructor and destructor private.
This keeps the end user from:
Creating an instance manually on the heap
Creating an instance manually on the stack
Deleting a shared_ptr manually using "delete get()"









