Skip to content
Related Articles

Related Articles

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

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :