Skip to content
Related Articles
Open in App
Not now

Related Articles

Ruby | StringScanner empty? function

Improve Article
Save Article
  • Last Updated : 12 Dec, 2019
Improve Article
Save Article

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
Related Articles

Start Your Coding Journey Now!