Skip to content
Related Articles

Related Articles

Improve Article
Ruby | StringScanner string function
  • Last Updated : 12 Dec, 2019

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 code for StringScanner.string() method
  
# loading StringScanner
require 'strscan'
  
# declaring StringScanner 
c = StringScanner.new("Mon Sep 12 2018 14:39")
  
# string() method
puts "String Scanner string form : #{c.string()}\n\n"

Output :

String Scanner string form : Mon Sep 12 2018 14:39

Example #2 :




# 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()}\n\n"

Output :

String Scanner string form : hellogeeks

My Personal Notes arrow_drop_up
Recommended Articles
Page :