Ruby | StringScanner check_until function
Last Updated :
12 Dec, 2019
StringScanner#check_until() : check_until() is a StringScanner class method which returns the value that scan_until would return, without advancing the scan pointer.
Syntax: StringScanner.check_until()
Parameter: StringScanner values
Return: the value that scan_until would return, without advancing the scan pointer.
Example #1 :
require 'strscan'
c = StringScanner. new ( "Fri Dec 12 1975 14:39" )
puts "String Scanner check_until form : #{c.check_until /1975/}\n\n"
|
Output :
String Scanner check_until form : Fri Dec 12 1975
Example #2 :
require 'strscan'
c = StringScanner. new ( "hellogeeks" )
puts "String Scanner check_until form : #{c.check_until /ge/}\n\n"
|
Output :
String Scanner check_until form : helloge
Share your thoughts in the comments
Please Login to comment...