红宝石 | StringScanner 为空?函数
StringScanner#empty?() : empty?()是一个 StringScanner 类方法,用于检查 stringIO 是否为空。
Syntax: StringScanner.empty?()
Parameter: StringScanner values
Return: true – if the stringIO is empty otherwise return 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