`
ltl3884
  • 浏览: 132252 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

ruby预先定义变数(Pre-defined Variable)

    博客分类:
  • ruby
 
阅读更多
预先定义变数(Pre-defined Variable)

与异常相关:

$!          raise设定的异常资讯讯息。
$@ 最近被掷出之异常的追踪资讯阵列。
与最近字样比对动作相关:

$& 符合字样之内容。
$` 符合字样之字串左侧的内容。
$' 符合字样之字串右侧的内容。
$+ 符合最后一个字样分组的内容。
$1 to $9 符合第1 到9 个字样分组的内容。
$~ 比对动作相关资讯。
$= The flag for case insensitive, nil by default.
$/ The input record separator, newline by default.
$\ The output record separator for the print and IO#write. Default is nil.
$, The output field separator for the print and Array#join.
$; The default separator for String#split.
$. The current input line number of the last file that was read.
$< The virtual concatenation file of the files given on command line.
$> The default output for print, printf. $stdout by default.
$_ The last input line of string by gets or readline.
$0 手稿程式的名称。可指派。
$*命令列引数阵列,即ARGV。
$$ 运行手稿程式的Ruby 行程识别码(PID)。
$? 最后执行的子行程之状态码。
$: 载入(load or require)手稿程式档案或模组时之搜寻路径的阵列。
$"以require载入的模组名称之阵列。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics