Ruby | StringScanner check function
StringScanner#check() : check() is a StringScanner class method which returns the value that scan would return, without advancing the scan pointer
Syntax: StringScanner.check()
Parameter: StringScanner values
Return: the value that scan would return, without advancing the scan pointer
Example #1 :
# Ruby code for StringIO.check() method # loading StringIO require 'strscan' # declaring StringIO c = StringScanner. new ( "Fri Dec 12 1975 14:39" ) # check() method puts "String Scanner check form : #{c.check /Fri/}\n\n" |
Output :
String Scanner check form : Fri
Example #2 :
# Ruby code for StringIO.check() method # loading StringIO require 'strscan' # declaring StringIO c = StringScanner. new ( "helloBeginner" ) # check() method puts "String Scanner check form : #{c.check /hel/}\n\n" |
Output :
String Scanner check form : hel
Contact Us