简体   繁体   English

如何将字符串中的ASCII字符转换为jQuery中的字符?

[英]How to convert ascii character in string to character in jquery?

I have an input button : 我有一个输入按钮:

   <input type="button" class="btn btn-success pull-right" id="doneBtn" value="@Resource.Add (0) @Resource.productsToCampaign" />

@Resource.Add and @Resource.productsToCampaign is dynamicly loaded depends on which language a user have chosen. 动态加载@ Resource.Add和@ Resource.productsToCampaign取决于用户选择的语言。

The problem is that when i want to update (0) to some number depends on how many items user chooses, @Resource.Add in one language have some special character which encodes to ø when i update value of the button. 问题是,当我想将(0)更新为某个数字取决于用户选择的项目数时,@ Resource.Add用一种语言添加时有一些特殊字符,当我更新按钮的值时会编码为ø。

what happends when user updates item list : 用户更新项目列表时会发生什么:

    var add = '\@Resource.Add';
$("#doneBtn").val(add + '(' + temporarySelectedItems.length + ')' + '@Resource.productsToCampaign');

charcode at will not work, because strings in different languages are not same length charcode at无法使用,因为不同语言的字符串长度不同

Any ideas? 有任何想法吗?

如果@ Resource.Add不包含'(',我将使用indexof('(')来查找数字的起始位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM