📜  红宝石 | StringScanner 为空?函数

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

红宝石 | StringScanner 为空?函数

StringScanner#empty?() : empty?()是一个 StringScanner 类方法,用于检查 stringIO 是否为空。

示例 #1:

# Ruby code for StringIO.empty?() method
  
# loading StringIO
require 'strscan'
  
# declaring StringIO 
c = StringScanner.new("Fri Dec 12 1975 14:39")
  
# empty?() method
puts "String Scanner empty? form : #{c.empty?()}\n\n"

输出 :

String Scanner empty? form : false

示例 #2:

# Ruby code for StringIO.empty?() method
  
# loading StringIO
require 'strscan'
  
# declaring StringIO 
c = StringScanner.new("hellogeeks")
  
# empty?() method
puts "String Scanner empty? form : #{c.empty?()}\n\n"

输出 :

String Scanner empty? form : false