Ruby | StringScanner restsize function Last Updated : 09 Dec, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 StringScanner.restsize() method # loading StringScanner require 'strscan' # declaring StringScanner c = StringScanner.new("Mon Sep 12 2018 14:39") # restsize() method c.pos = 2 puts "String Scanner restsize form : #{c.restsize}\n\n" # restsize() method c.pos = 7 puts "String Scanner restsize form : #{c.restsize}\n\n" Output : String Scanner restsize form : 19 String Scanner restsize form : 14 Example #2 : Ruby # Ruby code for StringScanner.restsize() method # loading StringScanner require 'strscan' # declaring StringScanner c = StringScanner.new("hellogeeks") # restsize() method c.pos = 2 puts "String Scanner restsize form : #{c.restsize}\n\n" # restsize() method c.pos = 7 puts "String Scanner restsize form : #{c.restsize}\n\n" Output : String Scanner restsize form : 8 String Scanner restsize form : 3 Comment More infoAdvertise with us Next Article Ruby | StringScanner rest? 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 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 # R 1 min read 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 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 peek function StringScanner#peek() : peek() is a StringScanner class method which returns a string corresponding to string[pos, len]. Syntax: StringScanner.peek() Parameter: StringScanner values len - length of the string value Return: a string corresponding to string[pos, len] Example #1 : Ruby # Ruby code for S 1 min read Ruby | StringScanner peep function StringScanner#peep() : peep() is a StringScanner class method which returns a string corresponding to string[pos, len]. Syntax: StringScanner.peep() Parameter: StringScanner values len - length of the string value Return: a string corresponding to string[pos, len] Example #1 : Ruby # Ruby code for S 1 min read Like