Return symbol: Difference between revisions
Jump to navigation
Jump to search
→如何取代換行符號
mNo edit summary |
|||
| Line 104: | Line 104: | ||
* MySQL: {{kbd | key=<nowiki>SELECT REPLACE(REPLACE(REPLACE(`column`,'\r\n',''),'\n',''),'\r','') </nowiki>}} <ref> [https://stackoverflow.com/questions/13273343/replace-new-line-character-in-mysql-not-working sql - REPLACE new line character in MYSql not working - Stack Overflow] </ref> or {{kbd | key=<nowiki>SELECT TRIM(REPLACE(`column`, '\n','' ))</nowiki>}} <ref>[https://stackoverflow.com/questions/28368785/mysql-trim-both-whitespace-and-newline-characters MySQL: trim *both* whitespace and newline characters - Stack Overflow]</ref> | * MySQL: {{kbd | key=<nowiki>SELECT REPLACE(REPLACE(REPLACE(`column`,'\r\n',''),'\n',''),'\r','') </nowiki>}} <ref> [https://stackoverflow.com/questions/13273343/replace-new-line-character-in-mysql-not-working sql - REPLACE new line character in MYSql not working - Stack Overflow] </ref> or {{kbd | key=<nowiki>SELECT TRIM(REPLACE(`column`, '\n','' ))</nowiki>}} <ref>[https://stackoverflow.com/questions/28368785/mysql-trim-both-whitespace-and-newline-characters MySQL: trim *both* whitespace and newline characters - Stack Overflow]</ref> | ||
* Excel: {{kbd | key=<nowiki>=TRIM(SUBSTITUTE(SUBSTITUTE(A1, CHAR(13),""), CHAR(10),", ")</nowiki>}} to replace the return symbol in the cell located at {{kbd | key=A1}} <ref>[https://www.ablebits.com/office-addins-blog/2013/12/03/remove-carriage-returns-excel/ 3 ways to remove carriage returns in Excel: formulas, VBA macro, find&replace dialog] {{access | date = 2018-05-24}}</ref><ref>[https://en.wikipedia.org/wiki/ASCII ASCII - Wikipedia]</ref>. | * Excel: | ||
** {{kbd | key=CHAR(10)}} means "Line feed" which equal to {{kbd | key=<nowiki>\n</nowiki>}} | ** {{kbd | key=<nowiki>=CLEAN(A1)</nowiki>}} Use the CLEAN function to "remove the first 32 nonprinting characters in the 7-bit ASCII code (values 0 through 31) from the text"<ref>[https://support.microsoft.com/en-us/office/clean-function-26f3d7c5-475f-4a9c-90e5-4b8ba987ba41 CLEAN function]</ref>. Meanwhile, the return symbol will be removed from the text. | ||
** {{kbd | key=CHAR(13)}} means "Carriage return" which equal to {{kbd | key=<nowiki>\r</nowiki>}} | ** {{kbd | key=<nowiki>=TRIM(SUBSTITUTE(SUBSTITUTE(A1, CHAR(13),""), CHAR(10),", ")</nowiki>}} to replace the return symbol in the cell located at {{kbd | key=A1}} <ref>[https://www.ablebits.com/office-addins-blog/2013/12/03/remove-carriage-returns-excel/ 3 ways to remove carriage returns in Excel: formulas, VBA macro, find&replace dialog] {{access | date = 2018-05-24}}</ref><ref>[https://en.wikipedia.org/wiki/ASCII ASCII - Wikipedia]</ref>. | ||
*** {{kbd | key=CHAR(10)}} means "Line feed" which equal to {{kbd | key=<nowiki>\n</nowiki>}} | |||
*** {{kbd | key=CHAR(13)}} means "Carriage return" which equal to {{kbd | key=<nowiki>\r</nowiki>}} | |||
* Python way: [https://stackoverflow.com/questions/275018/how-can-i-remove-a-trailing-newline-in-python How can I remove a trailing newline in Python? - Stack Overflow] {{access | date = 2019-06-14}} | * Python way: [https://stackoverflow.com/questions/275018/how-can-i-remove-a-trailing-newline-in-python How can I remove a trailing newline in Python? - Stack Overflow] {{access | date = 2019-06-14}} | ||