StringScanner#search_full() : search_full() es un método de StringScanner que escanea la string hasta que el patrón coincide.
Sintaxis: StringScanner.search_full()
Parámetro:
patrón de valores de
StringScanner advance_pointer
return_pointerRetorno: string coincidente si return_string_p es verdadero; de lo contrario, devuelve la cantidad de bytes avanzados
Ejemplo 1 :
# Ruby code for StringScanner.search_full() method # loading StringScanner require 'strscan' # declaring StringScanner c = StringScanner.new("Mon Sep 12 2018 14:39") # search_full() method c.search_full(/\w+/, 2, 3) puts "String Scanner result of c.search_full() form : #{c.pos()}\n\n" # search_full() method c.search_full(/\s+/, 4, 8) puts "String Scanner result of c.search_full() form : #{c.pos()}\n\n"
Producción :
String Scanner result of c.search_full() form : 3 String Scanner result of c.search_full() form : 4
Ejemplo #2:
# Ruby code for StringScanner.search_full() method # loading StringScanner require 'strscan' # declaring StringScanner c = StringScanner.new("h ello geeks") # search_full() method c.search_full(/\w+/, 2, 3) puts "String Scanner result of c.search_full() form : #{c.pos()}\n\n" search_full() method c.search_full(/\s+/, 4, 8) puts "String Scanner result of c.search_full() form : #{c.pos()}\n\n"
Producción :
String Scanner result of c.search_full() form : 1 String Scanner result of c.search_full() form : 2
Publicación traducida automáticamente
Artículo escrito por mayank5326 y traducido por Barcelona Geeks. The original can be accessed here. Licence: CCBY-SA