Ruby | StringScanner rest_size function Last Updated : 10 Dec, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 StringScanner.rest_size() method # loading StringScanner require 'strscan' # declaring StringScanner c = StringScanner.new("Mon Sep 12 2018 14:39") # rest_size() method c.pos = 2 puts "String Scanner rest_size form : #{c.rest_size}\n\n" # rest_size() method c.pos = 7 puts "String Scanner rest_size form : #{c.rest_size}\n\n" Output : String Scanner rest_size form : 19 String Scanner rest_size form : 14 Example #2 : Ruby # Ruby code for StringScanner.rest_size() method # loading StringScanner require 'strscan' # declaring StringScanner c = StringScanner.new("hellogeeks") # rest_size() method c.pos = 2 puts "String Scanner rest_size form : #{c.rest_size}\n\n" # rest_size() method c.pos = 7 puts "String Scanner rest_size form : #{c.rest_size}\n\n" Output : String Scanner rest_size form : 8 String Scanner rest_size form : 3 Comment More infoAdvertise with us Next Article Ruby | StringScanner reset 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 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 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 matched_size function StringScanner#matched_size() : matched_size() is a StringScanner class method which returns the size of the most recent match Syntax: StringScanner.matched_size()Parameter: StringScanner valuesReturn: the size of the most recent match otherwise return nil Example #1 :Â Ruby # Ruby code for StringSca 1 min read Ruby | StringScanner skip function StringScanner#skip() : skip() is a StringScanner class method which skip over the given pattern beginning with the scan pointer. Syntax: StringScanner.skip() Parameter: StringScanner values pattern Return: skip over the given pattern beginning with the scan pointer. Example #1 : Ruby # Ruby code for 1 min read Like