Ruby StringScanner eos? 函数
StringScanner#eos?() : eos?()是StringScanner类的一个方法,用于检查扫描指针是否在字符串的末端。
语法。StringScanner.eos?()
参数。StringScanner的值
返回:如果扫描指针在字符串的末尾为true,否则返回false
例子 #1 :
# Ruby code for StringIO.eos?() method
# loading StringIO
require 'strscan'
# declaring StringIO
c = StringScanner.new("Fri Dec 12 1975 14:39")
# eos?() method
puts "String Scanner eos? form : #{c.eos?()}\n\n"
输出:
String Scanner eos? form : false
例子 #2 :
# Ruby code for StringIO.eos?() method
# loading StringIO
require 'strscan'
# declaring StringIO
c = StringScanner.new("hellogeeks")
# stringIO is terminated
c.terminate
# eos?() method
puts "String Scanner eos? form : #{c.eos?()}\n\n"
输出:
String Scanner eos? form : true