Ruby | StringScanner rest function Last Updated : 10 Dec, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report StringScanner#rest() : rest() is a StringScanner class method which returns the “rest” of the string (i.e. everything after the scan pointer). Syntax: StringScanner.rest() Parameter: StringScanner values Return: the “rest” of the string (i.e. everything after the scan pointer). Example #1 : Ruby # Ruby code for StringScanner.rest() method # loading StringScanner require 'strscan' # declaring StringScanner c = StringScanner.new("Mon Sep 12 2018 14:39") # rest() method c.pos = 2 puts "String Scanner rest form : #{c.rest}\n\n" # rest() method c.pos = 7 puts "String Scanner rest form : #{c.rest}\n\n" Output : String Scanner rest form : n Sep 12 2018 14:39 String Scanner rest form : 12 2018 14:39 Example #2 : Ruby # Ruby code for StringScanner.rest() method # loading StringScanner require 'strscan' # declaring StringScanner c = StringScanner.new("hellogeeks") # rest() method c.pos = 2 puts "String Scanner rest form : #{c.rest}\n\n" # rest() method c.pos = 7 puts "String Scanner rest form : #{c.rest}\n\n" Output : String Scanner rest form : llogeeks String Scanner rest form : eks Comment More infoAdvertise with us Next Article Ruby | StringScanner pos= function M mayank5326 Follow Improve Article Tags : Ruby Ruby-Methods Ruby String Scanner-class Similar Reads Ruby | StringScanner rest? function 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 : Ruby # Ruby code for StringScanner.rest? 1 min read Ruby | StringScanner reset function StringScanner#reset() : reset() is a StringScanner class method which reset the scan pointer (index 0) and clear matching data. Syntax: StringScanner.reset() Parameter: StringScanner values Return: reset the scan pointer (index 0) and clear matching data. Example #1 : Ruby # Ruby code for StringScan 1 min read Ruby | StringScanner restsize function StringScanner#restsize() : restsize() is a StringScanner class method which returns the size of the bytes after the string position. Syntax: StringScanner.restsize() Parameter: StringScanner values Return: the size of the bytes after the string position. Example #1 : Ruby # Ruby code for StringScann 1 min read Ruby | StringScanner rest_size function StringScanner#rest_size() : rest_size() is a StringScanner class method which returns the size of the bytes after the string position. Syntax: StringScanner.rest_size() Parameter: StringScanner values Return: the size of the bytes after the string position. Example #1 : Ruby # Ruby code for StringSc 1 min read Ruby | StringScanner pos= function StringScanner#pos=() : pos=() is a StringScanner class method which sets the byte position of the scan pointer. Syntax: StringScanner.pos=() Parameter: StringScanner values Return: sets the byte position of the scan pointer. Example #1 : Ruby # Ruby code for StringScanner.pos=() method # loading Str 1 min read Ruby | StringScanner getch function StringScanner#getch() : getch() is a StringScanner class method which returns the byte of pointer on the StringScanner. Syntax: StringScanner.getch() Parameter: StringScanner values Return: the byte of pointer on the StringScanner. Example #1 : Ruby # Ruby code for StringScanner.getch() method # loa 1 min read Like