Skip to content
Related Articles

Related Articles

Improve Article
Ruby | StringScanner beginning_of_line? function
  • Last Updated : 10 Dec, 2019

StringScanner#beginning_of_line?() : beginning_of_line?() is a StringScanner class method which checks whether the scan pointer is at the beginning of the line.

Syntax: StringScanner.beginning_of_line?()

Parameter: StringScanner values

Return: true – if scan pointer is at the beginning of the line otherwise return false

Example #1 :






# Ruby code for StringIO.beginning_of_line?() method
  
# loading StringIO
require 'strscan'
  
# declaring StringIO 
c = StringScanner.new('hi')
  
# beginning_of_line?() method
puts "StringScanner beginning_of_line? form : #{c.beginning_of_line?}\n\n"

Output :

StringScanner << bytes form : true

Example #2 :




# Ruby code for StringIO.beginning_of_line?() method
  
# loading StringIO
require 'strscan'
  
# declaring StringIO 
c = StringScanner.new('geeksforgeeks')
  
# beginning_of_line?() method
puts "StringScanner beginning_of_line? form : #{c.beginning_of_line?}\n\n"

Output :

StringScanner << bytes form : true
My Personal Notes arrow_drop_up
Recommended Articles
Page :