Ruby StringScanner empty? 函数
StringScanner#empty?() : empty?()是StringScanner类的一个方法,用于检查stringIO是否为空。
语法。StringScanner.empty?()
参数。StringScanner的值
返回:true – 如果stringIO是空的,否则返回false
例子 #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