如何将字符串的一部分返回到第一个实例" #"或" Apt"?
" #"
" Apt"
我知道我可以将字符串拆分为基于"#"或"Apt"然后调用的数组.first,但必须有一个更简单的方法.
"#"
"Apt"
.first
ruby string
ruby ×1
string ×1