StringScanner#inspect():inspect()是一種StringScanner類方法,該方法返回代表表示不同值的StringScanner對象的字符串。
用法:StringScanner.inspect()
參數:StringScanner值
返回:–當前位置
–字符串的大小
–掃描指針周圍的字符
示例1:
# Ruby code for StringScanner.inspect() method
# loading StringScanner
require 'strscan'
# declaring StringScanner
c = StringScanner.new("Mon Sep 12 2018 14:39")
# inspect() method
puts "String Scanner inspect form : #{c.inspect()}\n\n"
輸出:
String Scanner inspect form : #
示例2:
# Ruby code for StringScanner.inspect() method
# loading StringScanner
require 'strscan'
# declaring StringScanner
c = StringScanner.new("hellogeeks")
# inspect() method
puts "String Scanner inspect form : #{c.inspect()}\n\n"
輸出:
String Scanner inspect form : #
相關用法
- Ruby Symbol inspect用法及代碼示例
- Ruby Hash inspect()用法及代碼示例
- Ruby Struct inspect()用法及代碼示例
- Ruby Range inspect()用法及代碼示例
- Ruby Regexp inspect()用法及代碼示例
- Ruby Time inspect用法及代碼示例
- Ruby Rational inspect()用法及代碼示例
- Ruby Array class inspect()用法及代碼示例
- Ruby StringScanner eos?用法及代碼示例
- Ruby StringScanner pos=用法及代碼示例
- Ruby StringScanner pos用法及代碼示例
- Ruby StringScanner post_match用法及代碼示例
- Ruby StringScanner string=()用法及代碼示例
- Ruby StringScanner rest_size用法及代碼示例
- Ruby StringScanner pointer=用法及代碼示例
注:本文由純淨天空篩選整理自mayank5326大神的英文原創作品 Ruby | StringScanner inspect function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。