Show Menu
Cheatography

Ruby Array and String Cheat Sheet by

List of all available methods for ruby array and string.

Array predicates

#all?
#any?
#empty?
#eql?
#include?
#none?
#one?

String predicates

#ascii­_only?
#casecmp?
#casecmp
#empty?
#end_with?
#eql?
#include?
#match?
#match
#start­_with?
#unico­de_­nor­mal­ized?
#valid­_en­coding?

Array conver­sions

#old_to_s
#to_a
#to_ary
#to_h
#to_s

String conversion

#to_a
#to_c
#to_f
#to_i
#to_r
#to_s
#to_str
#to_sym

Array common

#each
#each_­index
#filter
#filter!
#find_­index
#first
#join
#length
#map
#map!
#last
#max
#min
#pop
#prepend
#reverse
#reverse!
#sample
#slice
#slice!
#sort
#sort!
#sort_by!

String common

#capit­alize
#capit­alize!
#downcase
#downcase!
#freeze
#gsub
#gsub!
#length
#prepend
#reverse
#reverse!
#slice
#slice!
#split
#chars
#upcase
#upcase!
 

String uncommon

#b
#bytes
#bytesize
#byteslice
#center
#chomp
#chomp!
#chop
#chop!
#chr
#clear
#codep­oints
#concat
#count
#crypt
#delete
#delete!
#delet­e_p­refix
#delet­e_p­refix!
#delet­e_s­uffix
#delet­e_s­uffix!
#dump
#each_byte
#each_char
#each_­cod­epoint
#graph­eme­_cl­usters
#each_­gra­phe­me_­cluster
#each_line
#encode
#encode!
#encoding
#force­_en­coding
#getbyte
#hash
#hex
#index
#initi­ali­ze_copy
#insert
#inspect
#intern
#lines
#ljust
#lstrip
#lstrip!
#next
#next!
#oct
#ord
#partition
#replace
#rindex
#rjust
#rpart­ition
#rstrip
#rstrip!
#scan
#scrub
#scrub!
#setbyte
#size
#squeeze
#squeeze!
#strip
#strip!
#sub
#sub!
#succ
#succ!
#sum
#swapcase
#swapcase!
#tr
#tr!
#tr_s
#tr_s!
#undump
#unico­de_­nor­malize
#unico­de_­nor­malize!
#unpack
#unpack1
#upto
 

Array uncommon

#append
#assoc
#at
#bsearch
#bsear­ch_­index
#clear
#collect
#collect!
#combi­nation
#compact
#compact!
#concat
#cycle
#decon­struct
#delete
#delete_at
#delete_if
#diffe­rence
#dig
#drop
#drop_­while
#fetch
#fill
#find_­index
#flatten
#flatten!
#hash
#index
#initi­ali­ze_copy
#insert
#inspect
#inter­section
#keep_if
#minmax
#pack
#permu­tation
#product
#rassoc
#reject
#reject!
#repea­ted­_co­mbi­nation
#repea­ted­_pe­rmu­tation
#replace
#rever­se_each
#rindex
#rotate
#rotate!
#select
#select!
#shift
#shuffle
#shuffle!
#sum
#take
#take_­while
#transpose
#union
#uniq
#uniq!
#unshift
#values_at
#zip
#count
#size
           
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          JavaScript Object Methods Cheat Sheet
          JavaScript Array API Cheat Sheet

          More Cheat Sheets by nirintsoa

          Programming Interview Live Coding Cheat Sheet
          Docker Cheat Sheet