Open In App

Ruby | StringScanner eos? function

Improve
Improve
Like Article
Like
Save
Share
Report

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

Last Updated : 12 Dec, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads