StringScanner#getbyte():getbyte()是一個StringScanner類方法,它返回StringScanner上的指針字節。
用法:StringScanner.getbyte()
參數:StringScanner值
返回:StringScanner上的指針字節。
示例1:
# Ruby code for StringScanner.getbyte() method
# loading StringScanner
require 'strscan'
# declaring StringScanner
c = StringScanner.new("Mon Sep 12 2018 14:39")
# getbyte() method
puts "String Scanner getbyte form : #{c.getbyte()}\n\n"
# getbyte() method
puts "String Scanner getbyte form : #{c.getbyte()}\n\n"
# getbyte() method
puts "String Scanner getbyte form : #{c.getbyte()}\n\n"
輸出:
String Scanner getbyte form : M String Scanner getbyte form : o String Scanner getbyte form : n
示例2:
# Ruby code for StringScanner.getbyte() method
# loading StringScanner
require 'strscan'
# declaring StringScanner
c = StringScanner.new("hellogeeks")
# getbyte() method
puts "String Scanner getbyte form : #{c.getbyte()}\n\n"
# getbyte() method
puts "String Scanner getbyte form : #{c.getbyte()}\n\n"
# getbyte() method
puts "String Scanner getbyte form : #{c.getbyte()}\n\n"
輸出:
String Scanner getbyte form : h String Scanner getbyte form : e String Scanner getbyte form : l
相關用法
- Ruby StringScanner pos用法及代碼示例
- Ruby StringScanner pos=用法及代碼示例
- Ruby StringScanner eos?用法及代碼示例
- Ruby StringScanner getch用法及代碼示例
- Ruby StringScanner matched?用法及代碼示例
- Ruby StringScanner check用法及代碼示例
- Ruby StringScanner clear用法及代碼示例
- Ruby StringScanner unscan用法及代碼示例
- Ruby StringScanner exist?用法及代碼示例
- Ruby StringScanner check_until用法及代碼示例
- Ruby StringScanner empty?用法及代碼示例
- Ruby StringScanner get_byte用法及代碼示例
- Ruby StringScanner inspect用法及代碼示例
- Ruby StringScanner string=()用法及代碼示例
- Ruby StringScanner peek用法及代碼示例
注:本文由純淨天空篩選整理自mayank5326大神的英文原創作品 Ruby | StringScanner getbyte function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。