📜  红宝石 | StringScanner begin_of_line?函数

📅  最后修改于: 2022-05-13 01:55:48.336000             🧑  作者: Mango

红宝石 | StringScanner begin_of_line?函数

StringScanner#beginning_of_line?() : begin_of_line?()是一个 StringScanner 类方法,用于检查扫描指针是否位于行首。

示例 #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