红宝石 | StringScanner 检查函数
StringScanner#inspect() :inspect()是一个 StringScanner 类方法,它返回表示显示不同值的 StringScanner 对象的字符串。
Syntax: StringScanner.inspect()
Parameter: StringScanner values
Return: – the current position
– the size of the string
– the characters surrounding the scan pointer
示例 #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 : #