Ruby | StringScanner rest? function
Last Updated :
09 Dec, 2019
StringScanner#rest?() : rest?() is a StringScanner class method which checks if there is more data in the string
Syntax: StringScanner.rest?()
Parameter: StringScanner values
Return: true if there is more data in the string otherwise return false
Example #1 :
require 'strscan'
c = StringScanner. new ( "Mon Sep 12 2018 14:39" )
c.pos = 2
puts "String Scanner rest? form : #{c.rest?}\n\n"
c.pos = 7
puts "String Scanner rest? form : #{c.rest?}\n\n"
|
Output :
String Scanner rest? form : true
String Scanner rest? form : true
Example #2 :
require 'strscan'
c = StringScanner. new ( "hellogeeks" )
c.pos = 2
puts "String Scanner rest? form : #{c.rest?}\n\n"
c.pos = 3
puts "String Scanner rest? form : #{c.rest?}\n\n"
|
Output :
String Scanner rest? form : true
String Scanner rest? form : true
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...