forked from freeCodeCamp/freeCodeCamp
-
Notifications
You must be signed in to change notification settings - Fork 2
Ruby String Operators
Quincy Larson edited this page Aug 20, 2016
·
1 revision
Both concatenation and multiplication can be performed on strings.
-
Strings can be joined together using any of the following methods:
-
+
operator -
<<
operator -
.concat
method
-
"Hello" + " World" + "!"
# returns:
Hello World!
"Hello" << " World!"
# returns:
Hello World!
string1 = "Hello"
string2 = " World!"
string1.concat(string2)
# returns:
Hello World!
- Strings can be multiplied by an integer value using the
*
operator.
"Hello" * 3
# returns:
HelloHelloHello
Previous | Home | Next |
---|---|---|
Ruby Basics | Table of Contents | Ruby String Methods |
Learn to code and help nonprofits. Join our open source community in 15 seconds at http://freecodecamp.com
Follow our Medium blog
Follow Quincy on Quora
Follow us on Twitter
Like us on Facebook
And be sure to click the "Star" button in the upper right of this page.
New to Free Code Camp?
JS Concepts
JS Language Reference
- arguments
- Array.prototype.filter
- Array.prototype.indexOf
- Array.prototype.map
- Array.prototype.pop
- Array.prototype.push
- Array.prototype.shift
- Array.prototype.slice
- Array.prototype.some
- Array.prototype.toString
- Boolean
- for loop
- for..in loop
- for..of loop
- String.prototype.split
- String.prototype.toLowerCase
- String.prototype.toUpperCase
- undefined
Other Links