Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
remove spaces in value
meilee
Hi,
How do I remove spaces in a value?
<iw_if expr=" length({iw_value name='list.description.summary'/}) > 0 "> //How do I check here to remove any spaces
<iw_then>
<star:summary category="<iw_value name='list.description.category'/>"><iw_value name='list.description.summary'/></star:summary>
</iw_then>
</iw_if>
Thanks,
Mei
Find more posts tagged with
Comments
Adam Stoller
Not sure about doing it in XML-mode, but you can certainly do it in Perl-mode:
<iw_perl>
# I assume that 'list' is defined earlier and/or that this code falls within something
# like an iw_iterate block
my $summary = iwpt_dcr_value('list.description.summary');
$summary =~ s/^\s+//;
# remove leading spaces
$summary =~ s/\s+$//;
# remove trailing spaces
if (length($summary)){
my $category = iwpt_dcr_value('list.description.category');
iwpt_output(qq(<star:summary category="$category">$summary</star:summary>\n));
}
</iw_perl>
I believe that should do it.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com