js換行符替換成空格&英文括號換成中文括號


輸入:

Random testing is not only a useful testing technique in itself, but also plays a core role in many other
testing methods. Hence, any significant improvement to random testing has an impact throughout the
software testing community. Recently, Adaptive Random Testing (ART) was proposed as an effective alternative to random testing. This paper presents a synthesis of the most important research results related
to ART. In the course of our research and through further reflection, we have realised how the techniques
and concepts of ART can be applied in a much broader context, which we present here. We believe such
ideas can be applied in a variety of areas of software testing, and even beyond software testing. Amongst
these ideas, we particularly note the fundamental role of diversity in test case selection strategies. We
hope this paper serves to provoke further discussions and investigations of these ideas

輸出:

Random testing is not only a useful testing technique in itself, but also plays a core role in many other testing methods. Hence, any significant improvement to random testing has an impact throughout the software testing community. Recently, Adaptive Random Testing (ART) was proposed as an effective alternative to random testing. This paper presents a synthesis of the most important research results related to ART. In the course of our research and through further reflection, we have realised how the techniques and concepts of ART can be applied in a much broader context, which we present here. We believe such ideas can be applied in a variety of areas of software testing, and even beyond software testing. Amongst these ideas, we particularly note the fundamental role of diversity in test case selection strategies. We hope this paper serves to provoke further discussions and investigations of these ideas

代碼:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>

    <body>
        <textarea id="big-textarea" placeholder="paste your origin html text here..." rows="30" cols="150">
        </textarea>
        <button id="big-button">Generate</button>
        
        <script type="text/javascript">
            let button = document.querySelector('#big-button');
            button.addEventListener('click', event => {
                let textArea = document.querySelector('#big-textarea');
                let inputTxt = textArea.value;
                textArea.value = 回車2空格(inputTxt);
            });
        </script>
                
        <script type="text/javascript">                    
            function 回車2空格(inputTxt) {
                let modifiedTxt = inputTxt.replace(/\n/g, " ");
                return modifiedTxt;
            }
        </script>
    </body>

</html>

還有一個需求,就是用在線翻譯后,括號變成英文括號:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>

    <body>
        <textarea id="big-textarea" placeholder="paste your origin html text here..." rows="30" cols="150">
        </textarea>
        <button id="btn1">回車2空格</button>
        <button id="btn2">英文括號2中文括號</button>
        
        <script type="text/javascript">
            let button1 = document.querySelector('#btn1');
            button1.addEventListener('click', event => {
                let textArea = document.querySelector('#big-textarea');
                let inputTxt = textArea.value;
                textArea.value = 回車2空格(inputTxt);
            });
            let button2 = document.querySelector('#btn2');
            button2.addEventListener('click', event => {
                let textArea = document.querySelector('#big-textarea');
                let inputTxt = textArea.value;
                textArea.value = 英文括號2中文括號(inputTxt);
            });
        </script>
                
        <script type="text/javascript">                    
            function 回車2空格(inputTxt) {
                let modifiedTxt = inputTxt.replace(/\n/g, " ");
                return modifiedTxt;
            }
            function 英文括號2中文括號(inputTxt) {
                let modifiedTxt1 = inputTxt.replace(/\(/g, "");
                let modifiedTxt2 = modifiedTxt1.replace(/\)/g, "");
                return modifiedTxt2;
            }
        </script>
    </body>

</html>
英文括號2中文括號.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM