07. Ruby String Slides - Ruby Core Teaching

quanhoangd129 110 views 22 slides Jul 19, 2024
Slide 1
Slide 1 of 22
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22

About This Presentation

Ruby String


Slide Content

RUBY STRING
Hoang Quan(BlazingRockStorm)

Contents
INTRODUCTION
USING QUOTES
CREATING STRING OBJECT
ESCAPE SEQUENCE
CONVERT TO STRING
INTERATING WITH STRING
ACCESSING STRING AS ARRAY
MULTILINE STRING
VARIABLE INTERPOLATION

Introduction

Introduction
String are one of the most important data
types in computer languages.
A string is a sequence of Unicode
characters. It is a data type that stores a
sequence of data values in which
elements usually stand for characters
according to a character encoding.
String objects may be created using
String::new or as literals. When a string
appears literally in source code, it is
known as a string literal.
In Ruby string literals are enclosed by
single or double quotes.

Creating string

Creating
string

Using quotes

Using quotes

Escape sequence

Escape
sequence

Converting to string

Converting to
string

Accessing string as array

Converting to
string

Multiline string

Multiline string

Multiline string

Variable interpolation

Variable interpolation
The %s and %d are formatting characters that expect a string and a
number, respectively. The values are provided in square brackets
after the % character.
Variable interpolation is replacing variables with their values inside
string literals. To substitute a variable with a value, the variable name
is put between #{var_name} characters inside the string literal

Other methods

Other methods

Thank you!
ありがとうございます!