红宝石 |字符串扫描仪 eos?函数
StringScanner#eos?() : eos?()是一个 StringScanner 类方法,用于检查扫描指针是否位于字符串的末尾。
Syntax: StringScanner.eos?()
Parameter: StringScanner values
Return: true if the scan pointer is at the end of the string otherwise return 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