Javascript中的字符串格式 [英] String Formatting in Javascript
本文介绍了Javascript中的字符串格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我需要知道我们在javascript中有非常类似于C#的string.format选项吗?
// C#中的示例代码段
字符串 strFormat = 名称:{0 },部门:{1},
字符串 myContent = 字符串。格式(strFormat, Jaiki, Admin);
先谢谢。
问候,Mahe
解决方案
有可用的功能。检查可以实现自定义代码的链接。
http://stackoverflow.com/questions/1038746/equivalent-of-string-format-in-jquery [ ^ ]
请参阅: JavaScript中的String.Format [ ^ ]
问候..
Hi All,
I need to know do we have string.format option in javascript very similar to C#.
//Sample Snippet in C#
String strFormat = "Name:{0}, Dept:{1}",
String myContent = String.Format(strFormat, "Jaiki", "Admin");
Thanks in Advance.
Regards,Mahe
解决方案
There is readely available function. Check the link where you can implement your own custom code.
http://stackoverflow.com/questions/1038746/equivalent-of-string-format-in-jquery[^]
See this: String.Format in JavaScript[^]
Regards..
这篇关于Javascript中的字符串格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文