本文简要介绍ruby语言中 English模块
的用法。
在 Ruby 脚本中包含 English
库文件,您可以使用下面列出的不那么神秘的名称来引用全局变量,例如 $_
。
没有“英语”:
$\ = ' -- '
"waterbuffalo" =~ /buff/
print $', $$, "\n"
用英语:
require "English"
$OUTPUT_FIELD_SEPARATOR = ' -- '
"waterbuffalo" =~ /buff/
print $POSTMATCH, $PID, "\n"
以下是说明性别名及其相关全局变量的完整列表:
- $ERROR_INFO
-
美元!
- $ERROR_POSITION
-
$@
- $FS
-
$;
- $FIELD_SEPARATOR
-
$;
- $OFS
-
$,
- $OUTPUT_FIELD_SEPARATOR
-
$,
- $RS
-
$/
- $INPUT_RECORD_SEPARATOR
-
$/
- $ORS
-
$\
- $OUTPUT_RECORD_SEPARATOR
-
$\
- $INPUT_LINE_NUMBER
-
美元。
- $NR
-
美元。
- $LAST_READ_LINE
-
$_
- $DEFAULT_OUTPUT
-
$>
- $DEFAULT_INPUT
-
$<
- $PID
-
$$
- $PROCESS_ID
-
$$
- $CHILD_STATUS
-
美元?
- $LAST_MATCH_INFO
-
$~
- $IGNORECASE
-
$=
- $ARGV
-
$*
- $匹配
-
$
- $预赛
-
$'
- $POSTMATCH
-
$'
- $LAST_PAREN_MATCH
-
$+
相关用法
- Ruby Engine.by_id用法及代码示例
- Ruby Engine.name用法及代码示例
- Ruby Engine.digest用法及代码示例
- Ruby Engine.id用法及代码示例
- Ruby Engine.cipher用法及代码示例
- Ruby Enumerable.any?用法及代码示例
- Ruby Enumerable min_by()用法及代码示例
- Ruby Enumerable each_witth_object()用法及代码示例
- Ruby Enumerable.slice_before用法及代码示例
- Ruby Enumerable each_cons()用法及代码示例
- Ruby Enumerator each_with_index用法及代码示例
- Ruby Encoding.compatible?用法及代码示例
- Ruby Enumerable.uniq用法及代码示例
- Ruby Enumerator each_with_object用法及代码示例
- Ruby Enumerable uniq()用法及代码示例
- Ruby Enumerable.find_all用法及代码示例
- Ruby Enumerator.peek_values用法及代码示例
- Ruby Enumerable.max用法及代码示例
- Ruby Enumerable.map用法及代码示例
- Ruby Enumerable min()用法及代码示例
- Ruby Enumerable.min_by用法及代码示例
- Ruby Enumerable.find_index用法及代码示例
- Ruby Enumerator类用法及代码示例
- Ruby Enumerable find_index()用法及代码示例
- Ruby Enumerable find_all()用法及代码示例
注:本文由纯净天空筛选整理自ruby-lang.org大神的英文原创作品 English模块。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。