文字列がサフィックスで終わっているかどうかをテストする関数が必要です。このタスクには「lastIndexOf」を使用できますが、標準の phobos 機能があるのだろうか?
1 に答える
7
はい、そうです。std.algorithm.endsWith
文字列だけでなく、他の配列や範囲でも機能します。例:
void main()
{
import std.algorithm.searching, std.stdio;
auto s = "Sunday";
auto b = s.endsWith("ay");
writeln(b); // true
}
于 2014-09-11T12:43:21.080 に答える