Ruby | StringScanner inspect function Last Updated : 09 Dec, 2019 Comments Improve Suggest changes Like Article Like Report StringScanner#inspect() : inspect() is a StringScanner class method which returns string that represents the StringScanner object showing different values. Syntax: StringScanner.inspect() Parameter: StringScanner values Return: - the current position - the size of the string - the characters surrounding the scan pointer Example #1 : Ruby # Ruby code for StringScanner.inspect() method # loading StringScanner require 'strscan' # declaring StringScanner c = StringScanner.new("Mon Sep 12 2018 14:39") # inspect() method puts "String Scanner inspect form : #{c.inspect()}\n\n" Output : String Scanner inspect form : # Example #2 : Ruby # Ruby code for StringScanner.inspect() method # loading StringScanner require 'strscan' # declaring StringScanner c = StringScanner.new("hellogeeks") # inspect() method puts "String Scanner inspect form : #{c.inspect()}\n\n" Output : String Scanner inspect form : # Comment More infoAdvertise with us Next Article Ruby | StringScanner inspect function M mayank5326 Follow Improve Article Tags : Ruby Ruby-Methods Ruby String Scanner-class Similar Reads 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 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 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 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 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 Like