简体   繁体   English

什么是PHP substr()的Ruby等价物?

[英]What is the Ruby equivalent of the PHP substr()?

什么是PHP语句的Ruby等价物

<?php echo substr("abcdefghijklm", 0, 5); ?>

Use the bracket notation, with the same two arguments as for substr . 使用括号表示法,使用与substr相同的两个参数。

substring = bigstring[0,5]

I used to recommend http://railsforphp.com/substr as a great way to find Ruby/Rails equivalents for common PHP functions, but apparently it's no longer online. 我曾经推荐http://railsforphp.com/substr作为查找常见PHP函数的Ruby / Rails等效的好方法,但显然它不再在线。 That's unfortunate :/ 那真不幸 :/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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