Skip to content
Related Articles

Related Articles

Ruby | StringScanner inspect function
  • Last Updated : 09 Dec, 2019

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 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 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 : #

My Personal Notes arrow_drop_up
Recommended Articles
Page :