Ruby StringScanner inspect函数
StringScanner#inspect() : inspect()是一个StringScanner类方法,它返回代表StringScanner对象的字符串,显示不同的值。
语法。StringScanner.expect()
参数。StringScanner的值
返回: – 当前位置
- 字符串的大小
- 扫描指针周围的字符
例子 #1 :
# Ruby code for StringScanner.inspect() method
# loading StringScanner
require 'strscan'
# declaring StringScanner
c = StringScanner.new("Mon Sep 12 2018 14:39")
# inspect() method
puts "String Scanner inspect form : #{c.inspect()}\n\n"
输出:
String Scanner inspect form : #
例子 #2 :
# Ruby code for StringScanner.inspect() method
# loading StringScanner
require 'strscan'
# declaring StringScanner
c = StringScanner.new("hellogeeks")
# inspect() method
puts "String Scanner inspect form : #{c.inspect()}\n\n"
输出:
String Scanner inspect form : #