All language subtitles for 010 ToString on Cards_en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

In the last section, we defined a custom to string function on our debt class.

So now any time we try to print out an instance of a deck, this function gets executed.

Right now we are returning a silly string.

It would be a lot better if we could somehow return our list of cards.

So this card's property right here so we could verify that the correct number and suit and rank of all

those cards are being created.

So maybe one way to do this would be to do something like, you know, I don't know, let's just try

returning that list of cards.

Let's just see what happens if we do this.

Well, when I put cards in here, you'll notice I very quickly get an error message.

So the return type list of cards isn't a string.

So when we call or when we define this two string method, the expectation is that we're going to return

a string from it and that string should be able to be used to represent this object.

So we can't just return any type of value that we want.

From this to string function, we have to specifically return a string.

So we need to somehow turn this list of cards right here into a string, one way that we could do that

is by using a built in function on the list object.

So whenever we create an instance of a list, as we are like right here, whenever we create this list

right here, this array or this list has a bunch of functions tied to it.

We already used one function was tied to it.

We use the ADD function inside of our constructor.

The list right here has another function tied to it, called, as you might guess, to string.

So every list that we make use of inside of DHAT has an automatically created to string function that

has been customized to properly print out a list.

So inside of our tutoring function, we're going to kind of delegate the printing of this object.

We're going to say, you know what, I don't know how to print out a deck.

Let's just return the cards list version of two string instead.

So now when we call to string on the list of cards, this right here is going to return a string representation

of that list of cards, and then you and I are going to return that from our two string.

And so we're kind of setting up a little bit of delegation here.

So any time that we call print on a deck, that's going to call our two string and we are going to delegate

the printing to the two string function that belongs to the list of cards.

OK, let's try running this and then seeing what happens.

OK, so click on Ron.

And now over here, you'll notice that I see what looks like a list I see like a whole bunch of records,

but what actually gets printed up is instance of card over and over and over again.

OK, well, you might be able to guess what's going on now.

So we've returned a representation of that list of cards.

However, when we call to string on the list of cards, that in turn calls to string on our card class

as well.

And so we get this huge chain of delegation of like the very top level to string, it's called, that

calls the cards to string and then the cards to string, in turn calls to string on the card class as

well.

And so that's why we're seeing this instance of card.

So to fix this up, we can now define a two string function on the card class itself, and from there

we can return a string representation of the card.

So let's try doing that.

Now, inside the card class, I'll add to string.

And then inside of here, I'll return a string and we'll try printing out something like, I don't know,

let's do something that kind of makes sense here, we'll do rank of suit like.

So remember that any time we use a dollar sign inside of a string, that is string interpolation.

And so this string right here is going to look at the rank property of the card instance and the suit

property of the card instance.

And it's going to insert them into the string.

All right, so let's try running this now.

So run that and now I see printed up much better, so we've got ace of diamonds, two of diamonds,

three of diamonds and so on.

OK, so I know that this two string stuff is a little bit strange, but essentially what's going on

is that any time we want to print up an instance of a class, if we want to have some customized message

there, we can simply define the two string function and then return our own kind of custom message

about what's going on with this particular record.

OK, so this looks pretty good.

Let's continue in the next section.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.