Skip to content
Related Articles

Related Articles

Improve Article
Ruby | StringScanner eos? function
  • Last Updated : 12 Dec, 2019

StringScanner#eos?() : eos?() is a StringScanner class method which checks whether the scan pointer is at the end of the string.

Syntax: StringScanner.eos?()

Parameter: StringScanner values

Return: true if the scan pointer is at the end of the string otherwise return false

Example #1 :






# Ruby code for StringIO.eos?() method
  
# loading StringIO
require 'strscan'
  
# declaring StringIO 
c = StringScanner.new("Fri Dec 12 1975 14:39")
  
# eos?() method
puts "String Scanner eos? form : #{c.eos?()}\n\n"

Output :

String Scanner eos? form : false

Example #2 :




# Ruby code for StringIO.eos?() method
  
# loading StringIO
require 'strscan'
  
# declaring StringIO 
c = StringScanner.new("hellogeeks")
  
# stringIO is terminated
c.terminate
  
# eos?() method
puts "String Scanner eos? form : #{c.eos?()}\n\n"

Output :

String Scanner eos? form : true
My Personal Notes arrow_drop_up
Recommended Articles
Page :