红宝石 | StringScanner字符串函数
StringScanner# 字符串() : 字符串()是一个 StringScanner 类方法,它返回被扫描的字符串。
Syntax: StringScanner.string()
Parameter: StringScanner values
Return: the string being scanned.
示例 #1:
# Ruby code for StringScanner.string() method
# loading StringScanner
require 'strscan'
# declaring StringScanner
c = StringScanner.new("Mon Sep 12 2018 14:39")
# string() method
puts "String Scanner string form : #{c.string()}\n\n"
输出 :
String Scanner string form : Mon Sep 12 2018 14:39
示例 #2:
# Ruby code for StringScanner.string() method
# loading StringScanner
require 'strscan'
# declaring StringScanner
c = StringScanner.new("hellogeeks")
# string() method
puts "String Scanner string form : #{c.string()}\n\n"
输出 :
String Scanner string form : hellogeeks