Open In App

Ruby | StringScanner empty? function

Last Updated : 12 Dec, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

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

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads