Ruby | StringScanner string=() function Last Updated : 10 Dec, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report StringScanner#string=() : string=() is a StringScanner class method which Changes the string being scanned to "str" and resets the scanner Syntax: StringScanner.string=() Parameter: StringScanner values Return: "str" Example #1 : Ruby # Ruby code for StringScanner.string=() method # loading StringScanner require 'strscan' # declaring StringScanner c = StringScanner.new("hellogeeks") # string=() method puts "String Scanner string= form : #{c.string=("hi")}\n\n" puts (c.string) Output : String Scanner string= form : hi hi Example #2 : Ruby # Ruby code for StringScanner.string=() method # loading StringScanner require 'strscan' # declaring StringScanner c = StringScanner.new("hellogeeks") # string=() method puts "String Scanner string= form : #{c.string=("go")}\n\n" puts (c.string) Output : String Scanner string= form : go go Comment More infoAdvertise with us Next Article Ruby | StringScanner scan_full function M mayank5326 Follow Improve Article Tags : Ruby Ruby-Methods Ruby String Scanner-class Similar Reads Ruby | StringScanner string function StringScanner#string() : string() is a StringScanner class method which returns the string being scanned. Syntax: StringScanner.string() Parameter: StringScanner values Return: the string being scanned. Example #1 : Ruby # Ruby code for StringScanner.string() method # loading StringScanner require ' 1 min read Ruby | StringScanner scan function StringScanner#scan() : scan() is a StringScanner class method which tries to match with pattern at the current position. Syntax: StringScanner.scan() Parameter: StringScanner values Return: matched string otherwise return false Example #1 : Ruby # Ruby code for StringScanner.scan() method # loading 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 Ruby | StringScanner scan_full function StringScanner#scan_full() : scan_full() is a StringScanner class method which checks whether the given pattern is matched from the current scan pointer Syntax: StringScanner.scan_full() Parameter: StringScanner values pattern advance_pointer return_pointer Return: true if the given pattern is matche 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 Like