红宝石 | StringScanner begin_of_line?函数
StringScanner#beginning_of_line?() : begin_of_line?()是一个 StringScanner 类方法,用于检查扫描指针是否位于行首。
Syntax: StringScanner.beginning_of_line?()
Parameter: StringScanner values
Return: true – if scan pointer is at the beginning of the line otherwise return 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