Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ----------------------------------------------------------------------------*
- // strip quote marks from a string -- workout which quoutes are used
- function trimQuotes($expr, $quoteChar='?')
- {
- $exprChar = substr($expr, 0, 1);
- if ( $quoteChar === '?'
- && strpos('\'\"', $exprChar) !== false) {
- $quoteChar = $exprChar;
- }
- return trim($expr, $quoteChar);
- }
- // ----------------------------------------------------------------------------*
- // add double quote marks to a string check that it doesn't have them already.
- function addQuotes($expr, $quotechar='"')
- {
- if (substr($expr, 0, 1) != $quotechar) {
- return $quotechar . $expr . $quotechar;
- }
- else {
- return $expr;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment