[pmwiki-users] variable value manipulation

Dominique Faure dominique.faure at gmail.com
Thu Oct 25 02:08:00 CDT 2007


On 10/25/07, sti at pooq.com <sti at pooq.com> wrote:
> TSgt Marshall Kelly wrote:
> > Is there a way to remove a space from the value of a variable?
> > Say a "trimleft" type command that would let me change "This Value" to
> > "ThisValue"
> >
> The cookbook recipe MarkupExprPlus (
> http://www.pmwiki.org/wiki/Cookbook/MarkupExprPlus ) has a wikiword function
> that will remove internal spaces, but it also capitalizes so that
>
>   {(wikiword 'some words')}
>
> becomes
>
>   SomeWords
>
> If that's not quite what you want, its easy to create new custom markup
> expressions to do what you want.
>

Using the same recipe you could also use regular expressions, having:

{(reg_replace '/\s/' '' ' Some Spaces   here ... ')}

rendering as:

SomeSpaceshere...

-- 
Dominique



More information about the pmwiki-users mailing list