📜  红宝石 |字符串扫描仪 eos?函数

📅  最后修改于: 2022-05-13 01:55:23.026000             🧑  作者: Mango

红宝石 |字符串扫描仪 eos?函数

StringScanner#eos?() : eos?()是一个 StringScanner 类方法,用于检查扫描指针是否位于字符串的末尾。

示例 #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