How do you convert a string to uppercase in ant? [

2019-05-27 01:21发布

问题:

Possible Duplicate:
Ant string functions?

I am modifying a wxi file as part of a wix install and updating a guid. As part of the "pedantic" warning setting if a guid is in lowercase the wix build fails.

How can I convert the guid to an uppercase string in ant?

EDIT: The Ant string functions thread is definitly the way to go - Ant string functions?

回答1:

You may use the Ant Plugin Flaka, no need to use a scripting language =

<project name="demo" xmlns:fl="antlib:it.haefelinger.flaka">
  <fl:install-property-handler />

    <property name="guid" value="a7655b5e-f074-4df1-9636-391aa234f4f4"/>

    <!-- simple echo -->
  <echo>
    #{'${guid}'.toupper}
   </echo>

    <!-- create new property for further processing -->
    <fl:let>
     guidtoupper := '#{'${guid}'.toupper}'
    </fl:let>

    <echo> $${guid} before => ${guid}</echo>

    <!-- overwrite existing property -->
  <fl:let>
   guid ::= '#{'${guid}'.toupper}'
  </fl:let>

    <echo> $${guid} after => ${guid}</echo>

</project>

output :

 [echo]     A7655B5E-F074-4DF1-9636-391AA234F4F4
 [echo]    
 [echo]  ${guid} before => a7655b5e-f074-4df1-9636-391aa234f4f4
 [echo]  ${guid} after => A7655B5E-F074-4DF1-9636-391AA234F4F4


标签: ant uppercase