source: branches/0.4/web/addons/job_monarch/dwoo/plugins/builtin/functions/whitespace.php @ 755

Last change on this file since 755 was 755, checked in by ramonb, 11 years ago
  • add Dwoo
File size: 1013 bytes
Line 
1<?php
2
3/**
4 * Replaces all white-space characters with the given string
5 * <pre>
6 *  * value : the text to process
7 *  * with : the replacement string, note that any number of consecutive white-space characters will be replaced by a single replacement string
8 * </pre>
9 * Example :
10 *
11 * <code>
12 * {"a    b  c          d
13 *
14 * e"|whitespace}
15 *
16 * results in : a b c d e
17 * </code>
18 *
19 * This software is provided 'as-is', without any express or implied warranty.
20 * In no event will the authors be held liable for any damages arising from the use of this software.
21 *
22 * @author     Jordi Boggiano <j.boggiano@seld.be>
23 * @copyright  Copyright (c) 2008, Jordi Boggiano
24 * @license    http://dwoo.org/LICENSE   Modified BSD License
25 * @link       http://dwoo.org/
26 * @version    1.0.0
27 * @date       2008-10-23
28 * @package    Dwoo
29 */
30function Dwoo_Plugin_whitespace_compile(Dwoo_Compiler $compiler, $value, $with=' ')
31{
32        return "preg_replace('#\s+#'.(strcasecmp(\$this->charset, 'utf-8')===0?'u':''), $with, $value)";
33}
Note: See TracBrowser for help on using the repository browser.