由于Notepad++里面的文字处理有些复杂,我在想能不能用一个Java程序来统一处理呢?
尝试了一下,发现不太复杂,Java果然处理各种事情都比较方便。程序如下:
注意在RegExp里面,必须用四个反斜杠\\\\代表一个反斜杠\
package com.pwc; import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; import java.util.ArrayList; import java.util.regex.Matcher; import java.util.regex.Pattern; public class WechatMomentDownload { public static String jsonFile = "C:\\Download\\exported_sns_gary.json"; public static String outputFolder = "C:\\Download\\gary_pic\\"; public static void main(String[] args) throws IOException { BufferedReader reader = null; String sLine = ""; String sContent = ""; String sLink = ""; URL url = null; String outputFile = ""; ArrayList<String> aLink = new ArrayList<String>(); String Regex1 = "CDATA\\[http\\:\\\\\\/\\\\\\/(sh)?mmsns([^]]*)\\/0\\]"; reader = new BufferedReader( new InputStreamReader(new FileInputStream(new File(jsonFile)), "UTF-8")); if (reader != null) { while ((sLine = reader.readLine()) != null) { sContent = sContent + sLine; } reader.close(); } Pattern pattern = Pattern.compile(Regex1); Matcher matcher = pattern.matcher(sContent); int count = 0; System.out.println("Start processing..."); while(matcher.find()) { count++; sLink = sContent.substring(matcher.start() + 6, matcher.end() - 1); sLink = sLink.replaceAll("\\\\/", "/"); aLink.add(sLink); } System.out.println(count + " pictures were found"); for (String sLinkTemp : aLink) { url = new URL(sLinkTemp); DataInputStream dataInputStream = new DataInputStream(url.openStream()); outputFile = outputFolder + count + ".jpg"; FileOutputStream fileOutputStream = new FileOutputStream(new File(outputFile)); ByteArrayOutputStream output = new ByteArrayOutputStream(); System.out.println("Downloading " + sLinkTemp + " to file " + outputFile); byte[] buffer = new byte[1024]; int length; while ((length = dataInputStream.read(buffer)) > 0) { output.write(buffer, 0, length); } fileOutputStream.write(output.toByteArray()); dataInputStream.close(); fileOutputStream.close(); count--; } System.out.println("End of processing..."); } }
更多notepad教程,请访问notepad使用教程栏目:https://www.php.cn/tool/notepad/
以上是用Java程式取代Notepad++的文字處理和Powershell的詳細內容。更多資訊請關注PHP中文網其他相關文章!

Notepad 由法國人DonHo創立,具有鮮明的法國烙印。 1.DonHo於2003年開發Notepad ,旨在替代Windows記事本,支持多種編程語言。 2.其官方網站和圖標設計體現了法國文化特色。 3.用戶可通過插件定制,如NppFTP提高工作效率,但需注意性能優化,如清理插件和合理使用多文檔界面。

Notepad 的安裝和初步使用步驟如下:1)訪問notepad-plus-plus.org下載適合版本;2)雙擊安裝文件並按提示安裝;3)啟動Notepad ,創建新文件並輸入文本;4)保存文件並選擇文件類型;5)編寫並運行簡單的Python程序,如print("Hello,Notepad !")。通過這些步驟,你可以順利開始使用Notepad 進行編程。

Notepad起源於從devedentbydonho.1)Donhostartednotepad in2003tocreateapower,用戶友好的textededitor.2)法國'stechcommunity andthegnugnugnugpllicenseflicenseflicenseflicensefacilitedglobalcontribution stonotepad .3)

記事本應將其納入theodonwindowsforitsproductivityfeatures.1)訪問officialWebSiteAndDownloadTheAppreprepreversion.2)runtheintheintheStallerandFollowPrompts,optiostallysylysallysociatingfiletypes.3)cutun custom andersociatsingfilesingfiletingfilesingfilesingfilesizesetsetsetsetsetsEtsEtsEtsEtsIzesEtsetsAndExplorePlorePloReplugInginSpost-Inallation。

Notepad 是一款在法國誕生的文本編輯器,由越南裔工程師DonHo於2003年開發。其受歡迎的原因包括:1.開源和免費,2.高效的性能,3.豐富的功能,如多文檔界面和插件系統。

記事本ISAPADER,自定義,自定義的ditorIdealForCoderSandWriters,offeringFeaturesLikesyntaxHighighlightingingingingIngingingingingAndPluginSupport.toInstall:1)下載fromTheOfficialWebsite,2)RuntheInstaller,選擇yourlangandInstallataltallationOptions,3)customizizepost-customizizepost

Notepad 的使用伴隨著時間、學習曲線和生產力損失的隱性成本,但可以通過利用插件、定制工作流程和結合其他工具來最大化其優勢。使用Notepad 可能需要更多時間手動完成任務,學習其插件系統和定制功能需要時間,簡潔性可能導致生產力損失,但通過安裝插件如NppFTP、定制快捷鍵和界面、結合使用GitBash和VisualStudioCode,可以有效提升開發效率。

Notepad 是完全免費且開源的。 1.它基於Windows,由DonHo開發,支持多種編程語言。 2.提供語法高亮、代碼折疊等功能,輕量且資源消耗低。 3.通過宏和插件如NppExec,可以自動化任務和執行外部命令。 4.建議定期更新,探索社區資源,並根據需求考慮其他編輯器。


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

SAP NetWeaver Server Adapter for Eclipse
將Eclipse與SAP NetWeaver應用伺服器整合。

Atom編輯器mac版下載
最受歡迎的的開源編輯器

SecLists
SecLists是最終安全測試人員的伙伴。它是一個包含各種類型清單的集合,這些清單在安全評估過程中經常使用,而且都在一個地方。 SecLists透過方便地提供安全測試人員可能需要的所有列表,幫助提高安全測試的效率和生產力。清單類型包括使用者名稱、密碼、URL、模糊測試有效載荷、敏感資料模式、Web shell等等。測試人員只需將此儲存庫拉到新的測試機上,他就可以存取所需的每種類型的清單。

禪工作室 13.0.1
強大的PHP整合開發環境

EditPlus 中文破解版
體積小,語法高亮,不支援程式碼提示功能