Related Articles

Related Articles

Ruby | StringScanner getbyte function
  • Last Updated : 09 Dec, 2019

StringScanner#getbyte() : getbyte() is a StringScanner class method which returns the byte of pointer on the StringScanner.

Syntax: StringScanner.getbyte()

Parameter: StringScanner values

Return: the byte of pointer on the StringScanner.

Example #1 :



filter_none

edit
close

play_arrow

link
brightness_4
code

# 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"

chevron_right


Output :

String Scanner getbyte form : M

String Scanner getbyte form : o

String Scanner getbyte form : n

Example #2 :

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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"

chevron_right


Output :

String Scanner getbyte form : h

String Scanner getbyte form : e

String Scanner getbyte form : l
My Personal Notes arrow_drop_up
Recommended Articles
Page :