Ruby StringScanner beginning_of_line? 函数
StringScanner#beginning_of_line?() : beginning_of_line?()是StringScanner类的一个方法,用于检查扫描指针是否在行的开头。
语法。StringScanner.beginning_of_line?()
参数。StringScanner的值
返回:true – 如果扫描指针在行的开头,否则返回false
例子 #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"
输出:
StringScanner << bytes form : true
例子 #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"
输出:
StringScanner << bytes form : true