Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Ruby | StringScanner empty? function

  • Last Updated : 12 Dec, 2019

StringScanner#empty?() : empty?() is a StringScanner class method which checks whether the stringIO is empty.

Syntax: StringScanner.empty?()

Parameter: StringScanner values

Return: true – if the stringIO is empty otherwise return false

Example #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"

Output :

String Scanner empty? form : false

Example #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"

Output :

String Scanner empty? form : false

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!