Open In App

Ruby | StringScanner eos? function

Last Updated : 12 Dec, 2019
Comments
Improve
Suggest changes
Like Article
Like
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
# 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
# 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

Next Article

Similar Reads