📜  红宝石 | StringScanner get_byte函数

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

红宝石 | StringScanner get_byte函数

StringScanner#get_byte() : 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