Home
Ruby
ActiveRecord
Array
CGI
Class
Collections
Database
Date
Design Patterns
Development
File Directory
GUI
Hash
Language Basics
Method
Network
Number
Rails
Range
Reflection
Statement
String
Threads
Time
Tk
Unit Test
Windows Platform
XML
Change character case of an element : Array Elements « Array « Ruby
Ruby
Array
Array Elements
Change character case of an element
a = [
'a'
,
'b'
,
'c'
] a[2].upcase! a.fill(2..4) {
'b'
} a[2].upcase!
Related examples in the same category
1.
have an array that contains objects from different classes, not all just one type.
2.
Accessing Elements
3.
use the at method
4.
Access the last element in the array
5.
With -1, you access the last element in an array by looping back around with a negative number.
6.
To change three of the elements to have German rather than English spelling.
7.
With start and length parameters
8.
Replacing subarrays with []=