Ruby StringScanner get_byte函数
StringScanner#get_byte() : get_byte()是StringScanner类的一个方法,用于返回StringScanner上指针的字节数。
语法。StringScanner.get_byte()
参数。StringScanner的值
返回:StringScanner上指针的字节数。
例子 #1 :
# Ruby code for StringScanner.get_byte() method
# loading StringScanner
require 'strscan'
# declaring StringScanner
c = StringScanner.new("Mon Sep 12 2018 14:39")
# get_byte() method
puts "String Scanner get_byte form : #{c.get_byte()}\n\n"
# get_byte() method
puts "String Scanner get_byte form : #{c.get_byte()}\n\n"
# get_byte() method
puts "String Scanner get_byte form : #{c.get_byte()}\n\n"
输出:
String Scanner get_byte form : M
String Scanner get_byte form : o
String Scanner get_byte form : n
例子 #2 :
# Ruby code for StringScanner.get_byte() method
# loading StringScanner
require 'strscan'
# declaring StringScanner
c = StringScanner.new("hellogeeks")
# get_byte() method
puts "String Scanner get_byte form : #{c.get_byte()}\n\n"
# get_byte() method
puts "String Scanner get_byte form : #{c.get_byte()}\n\n"
# get_byte() method
puts "String Scanner get_byte form : #{c.get_byte()}\n\n"
输出:
String Scanner get_byte form : h
String Scanner get_byte form : e
String Scanner get_byte form : l