You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by "Justin Mclean (JIRA)" <ji...@apache.org> on 2013/04/20 07:31:15 UTC
[jira] [Commented] (FLEX-17015) StringUtil.substitute It seems that
it will not work with Special charchacters like $ specially with $$ it will
omit one $.
[ https://issues.apache.org/jira/browse/FLEX-17015?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13637124#comment-13637124 ]
Justin Mclean commented on FLEX-17015:
--------------------------------------
It's actually in String.replace that $ has special meaning, so suggested fix doesn't fix.
> 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