zoukankan      html  css  js  c++  java
  • javascript版string.Format

    原文发布时间为:2011-03-28 —— 来源于本人的百度文章 [由搬家工具导入]

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <script type="text/javascript">
            var string = {
                Format: function (str) {
                    for (i = 1; i < arguments.length; i++) {
                        str = str.replace('{' + (i - 1) + '}', arguments[i]);
                    }
                    return str;
                }
            }
        </script>
    </head>
    <body>
        <div>
        <script type="text/javascript">
            alert(string.Format("NjayWu: {0} {1} !", "Hello", "World"));
        </script>
        </div>
    </body>
    </html>

  • 相关阅读:
    codevs 1031 质数环
    codevs 1005 生日礼物
    codevs 1004 四子连棋
    codevs 2292 图灵机游戏
    1439 统计素数个数
    1675 大质数 2
    codevs 1462 素数和
    [NOIp2012提高组]借教室
    [NOIp2007提高组]矩阵取数游戏
    [TJOI2017]城市
  • 原文地址:https://www.cnblogs.com/handboy/p/7163940.html
Copyright © 2011-2022 走看看