Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
これは私が調べたいファイルです。このtxtファイルの「str2」の前に「str1」が表示されることを知りたいです。
file.txt
aaa aa aa aaa a a aa str1 aa aa a aaa aa a aaa aaa aa str2 aa a a aa aaa ...
何百もの行を含む多数のファイルで使用できる優れたアルゴリズムを探しています! ps 私はまだソース コードを持っていません。私はまだ計画段階です。
ありがとう。
小切手
if(str.indexOf("str1") != -1 && str.indexOf("str2") != -1 && str.indexOf("str1") < str.indexOf("str2")) return true;