find
APIの多くはRubyと同じなので最初に探しましたが、見つかりませんfind
でした。したがって、次善の策はselect
+だと思いましたfirst
(私の配列は非常に小さいので、これで問題ありません)。
Crystal API select!
for an Array を見ると、Ruby と同じようにブロックが必要です。select!
受信配列を変更しているように見えますが、ありませんselect
(少なくとも確認できます!)。
これは私のコードです:
segment = text.split(' ').select! { |segment| segment.include?("rm_") }.first
エラーは次のとおりです。
segment = text.split(' ').select! { |segment| segment.include?("rm_") }.first
^~~~~~~