<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                ## 問題 Problem 你想把字符串的一部分替換為其他的值。 You need to replace a portion of a string with another value. ## 方法 Solution 使用JavaScript的`replace`方法。`replace`掉給定字符串中的匹配,返回修改后的字符串。 Use the JavaScript?`replace`?method.?`replace`?matches with the given string, and returns the edited string. 第一種形式,接受兩個參數:_模式_ 和?_替換為的字符串_ The first version takes 2 arguments:?_pattern_?and?_string replacement_ ~~~ "JavaScript is my favorite!".replace /Java/, "Coffee" # => 'CoffeeScript is my favorite!' "foo bar baz".replace /ba./, "foo" # => 'foo foo baz' "foo bar baz".replace /ba./g, "foo" # => 'foo foo foo' ~~~ 第二種形式,也是接受兩個參數:_模式_ 和?_回調函數_ The second version takes 2 arguments:?_pattern_?and?_callback function_ ~~~ "CoffeeScript is my favorite!".replace /(\w+)/g, (match) -> match.toUpperCase() # => 'COFFEESCRIPT IS MY FAVORITE!' ~~~ 每個匹配都會調用回調函數,并把匹配值作為參數傳遞給它。 The callback function is invoked for each match, and the match value is passed as the argument to the callback. ## 討論 Discussion 正則表示式是一種強大的匹配和替換字符串的方式。 Regular Expressions are a powerful way to match and replace strings.
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看