Ruby StringScanner beginning_of_line? 函数

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

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程