Ruby | StringScanner pointer function Last Updated : 09 Dec, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report StringScanner#pointer() : pointer() is a StringScanner class method which returns the byte position of the scan pointer Syntax: StringScanner.pointer() Parameter: StringScanner values Return: the byte position of the scan pointer Example #1 : Ruby # Ruby code for StringScanner.pointer() method # loading StringScanner require 'strscan' # declaring StringScanner c = StringScanner.new("Mon Sep 12 2018 14:39") # pointer() method puts "String Scanner pointer form : #{c.pointer()}\n\n" c.terminate() # pointer() method puts "String Scanner pointer form : #{c.pointer()}\n\n" Output : String Scanner pointer form : 0 String Scanner pointer form : 21 Example #2 : Ruby # Ruby code for StringScanner.pointer() method # loading StringScanner require 'strscan' # declaring StringScanner c = StringScanner.new("hellogeeks") # pointer() method puts "String Scanner pointer form : #{c.pointer()}\n\n" c.terminate() # pointer() method puts "String Scanner pointer form : #{c.pointer()}\n\n" Output : String Scanner pointer form : 0 String Scanner pointer form : 10 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 pointer= function StringScanner#pointer=() : pointer=() is a StringScanner class method which sets the byte position of the scan pointer. Syntax: StringScanner.pointer=() Parameter: StringScanner values Return: sets the byte pointerition of the scan pointer. Example #1 : Ruby # Ruby code for StringScanner.pointer=() 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 pos function StringScanner#pos() : pos() is a StringScanner class method which returns the byte position of the scan pointer Syntax: StringScanner.pos() Parameter: StringScanner values Return: the byte position of the scan pointer Example #1 : Ruby # Ruby code for StringScanner.pos() method # loading StringScann 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 Ruby | StringScanner inspect function 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 surroun 1 min read Like