Search
 
SCRIPT & CODE EXAMPLE
 

RUBY

ruby remove last element of string

'abc1234'.chomp(4) # => 'abc123'
'toto'.chomp('to') # => 'to'
Comment

how to remove last element from array in ruby

prices = [10, 20, 30, 40]

prices.pop

puts prices
Output:

[10, 20, 30]
Comment

PREVIOUS NEXT
Code Example
Ruby :: rails change database connection 
Ruby :: stripe test keys 
Ruby :: ruby assign value to hash 
Ruby :: how do I update an index in rails 
Ruby :: ruby remove nil element in array 
Ruby :: gem friendly_id with multiple column s 
Ruby :: rails bootstrap background image 
Ruby :: rails start id to 1000 
Ruby :: ruby array of symbols 
Ruby :: EOFError: end of file reached 
Ruby :: rails scope where not 
Ruby :: render to string rails 
Ruby :: Replacing consecutive numbers with dash between first and last in a range 
Ruby :: cant find user without id error in rails 
Ruby :: rails add element to array 
Ruby :: og meta tags not working rails 
Ruby :: rails print number with space 
Ruby :: ruby puts format 
Ruby :: time_ago_in_words for created_at model in rails 
R :: automatically wrap r text label ggplot 
R :: r list append 
R :: why is correlation na in r 
R :: list to dataframe in r 
R :: convert datetime from string r 
R :: how to read in a text file in r 
R :: r change column based on condition 
R :: rnorm in r 
R :: r function to get class of all columns 
R :: if in r 
R :: barplot_spacewidth 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =