简体   繁体   中英

Rails join a list of strings with commas and “and” before the last

是否有一个标准的铁轨助手可以将像["apple", "banana", "pear"]这样的字符串数组转换成"apple, banana, and pear"插入句子?

Yeah to_sentence ought to work nicely.

http://apidock.com/rails/Array/to_sentence

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM