terminal

How to run Ruby code from terminal?

依然范特西╮ 提交于 2020-11-30 02:15:05
问题 I need to run a few lines of Ruby code from terminal, but I can't find the needed parameter for it. Can you explain how to do this? 回答1: If Ruby is installed, then ruby yourfile.rb where yourfile.rb is the file containing the ruby code. Or irb to start the interactive Ruby environment, where you can type lines of code and see the results immediately. 回答2: You can run ruby commands in one line with the -e flag: ruby -e "puts 'hi'" Check the man page for more information. 来源: https:/

Oracle 常用的函数小结

谁说胖子不能爱 提交于 2020-11-10 03:58:11
1 Oracle 常用函数 1.1 字符函数 函数名 函数作用 备注 Lower(char) 使字符串char大写 Upper(char) 使字符串char小写 Length(char) 计算字串char长度 Substr(char,m,n) 将字串char从m截取n个字符 || 连接字符串 相当于java种的”+” Repace(char,char1,char2) 将字串char种的char1替换为char2 Ascii(char) 返回char的ascii码 互相逆 Char(number) 根据number返回字符 Concat(char1,char2) 等同char1||char2 Initcap(char) 将char字串的单词首字母大写其他字母小写 Instr(c1,c2,i,j) 从c1的i位置开始查找第j次出现的c2的位置 i为负数则从右到左查找.i和j默认值都是1 Ltrim(c1,c2) 使c1字串的开头字母不在c2中 Decode(value,value1,result,result1) Value和value1对比,相等返回result,否则返回result1 Value1对应result..这两个值可以连续出现..匹配..其实也就是case语句..但是只能匹配等价值,感觉不如case= =!! 1.2 数学函数 函数名 函数作用 备注 Round