flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Justin Mclean (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (FLEX-17015) StringUtil.substitute It seems that it will not work with Special charchacters like $ specially with $$ it will omit one $.
Date Sat, 20 Apr 2013 05:31:16 GMT

     [ https://issues.apache.org/jira/browse/FLEX-17015?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Justin Mclean resolved FLEX-17015.
----------------------------------

    Resolution: Not A Problem

Substitute method uses String.replace method. Certain $ combinations have special meaning.
Added comment to code explaining how to avoid this ie escape $ with $$.
                
> StringUtil.substitute It seems that it will not work with Special charchacters like $
specially with $$ it will omit one $.
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: FLEX-17015
>                 URL: https://issues.apache.org/jira/browse/FLEX-17015
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: Collections
>    Affects Versions: Adobe Flex SDK 3.0 (Release)
>         Environment: Affected OS(s): Windows
> Affected OS(s): Windows XP
> Browser: Internet Explorer 6.x
> Language Found: English
>            Reporter: Adobe JIRA
>
> Steps to reproduce:
> var message:String = "Dear {0}"
> var subContent:String = "xyz $$";
> var outPut :String ;
> outPut = StringUtil.substitute(message, subContent) ;
>  
>  Actual Results: 
> value of outPut is  Dear xyz $
>  
>  
>  Expected Results:
> value of OutPut Should be  Dear xyz $$
>  
>  
>  Workaround (if any):
> public static function customSubstitute(str:String, ... rest):String
>     {
>         if (str == null) return '';
>         // Replace all of the parameters in the msg string.
>         var len:uint = rest.length;
>         var args:Array;
>         if (len == 1 && rest[0] is Array)
>         {
>             args = rest[0] as Array;
>             len = args.length;
>         }
>         else
>         {
>             args = rest;
>         }
>         for (var i:int = 0; i < len; i++)
>         {
>             str = str.replace("{"+i+"}", args[i]);
>         }
>         return str;
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message