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.
別の関数「InStr」を使用するにはどうすればよいですか。これは私が使用しているコードであり、正常に動作しますが、InStr から離れることが私の目標です
i = InStr(1, Hostname, Environment.Newline)
同等の C# コードが必要な場合は、アセンブリStringsからクラスを使用できMicrosoft.VisualBasicます。したがって、コードは次のようになります。
Strings
Microsoft.VisualBasic
using Microsoft.VisualBasic; . . . i = Strings.InStr(1, Hostname, Environment.NewLine);
別のアプローチは、適切なString.Indexof関数を使用することです。
String.Indexof
リンク: