All language subtitles for 8. Character by Character Comparison

af Afrikaans
sq Albanian
am Amharic
ar Arabic Download
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
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
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:01,080 --> 00:00:01,460 All right. 2 00:00:01,480 --> 00:00:05,950 Let's try doing this character by character comparison using a template based approach. 3 00:00:05,950 --> 00:00:10,510 Again the idea here is they're going to stuff in a lot of logic to our template to compare each character 4 00:00:11,210 --> 00:00:14,720 to first begin by going back over to my app components. 5 00:00:14,770 --> 00:00:18,550 I just want to remind you very quickly that we've got two properties available to us. 6 00:00:18,550 --> 00:00:21,100 We have random text and we have entered text. 7 00:00:21,160 --> 00:00:27,100 So we want to iterate over random text and for every character we want to printed out on our template 8 00:00:27,730 --> 00:00:31,870 and then for each of those characters we print out we want to compare the character against entered 9 00:00:31,870 --> 00:00:32,750 text. 10 00:00:32,850 --> 00:00:35,170 If they're the same we want to somehow color green. 11 00:00:35,170 --> 00:00:37,000 Otherwise color it red. 12 00:00:37,000 --> 00:00:43,630 Let's first begin by just trying to print out every character of random text one by one but to do so 13 00:00:43,660 --> 00:00:47,950 I'll go back over to my template I'm gonna find the paragraph elements where currently we are printing 14 00:00:47,950 --> 00:00:53,170 out the entire string I'm going to delete that and replace it with a span element. 15 00:00:53,360 --> 00:00:59,530 They're going to print out every character one by one and side of separate span elements to do so we're 16 00:00:59,530 --> 00:01:02,800 going to use the energy for structural directive on this thing. 17 00:01:03,020 --> 00:01:10,670 They'll say Star and G4 and then inside there we're going to set up our statement to take a look at 18 00:01:10,670 --> 00:01:13,250 the random text property and iterate over it. 19 00:01:13,250 --> 00:01:20,370 Character by character will say let letter of random text. 20 00:01:20,390 --> 00:01:25,310 Now as I mentioned in the last video at the very end when you use energy for angular wants to see an 21 00:01:25,310 --> 00:01:28,070 array right here right now we've got a string. 22 00:01:28,210 --> 00:01:33,710 If you save this as is and then flip back over to your application and open up your console you're probably 23 00:01:33,710 --> 00:01:40,010 gonna see a really big error message like this though it says specifically energy for wants to see an 24 00:01:40,040 --> 00:01:47,550 array but we are providing a string instead but let's go back over to find random text right here and 25 00:01:47,550 --> 00:01:53,490 all we have to do to turn that string into an array is add on that split and split by empty string. 26 00:01:53,910 --> 00:01:59,690 That will take that string right there and give us an array of Strings instead now to test this out 27 00:02:00,080 --> 00:02:01,220 inside the span. 28 00:02:01,280 --> 00:02:06,760 I'm going to try to use string interpolation to print out the value of letter inside of a span. 29 00:02:06,890 --> 00:02:14,250 Put in double curly braces and I'll print out the letter inside their will then save this you know flip 30 00:02:14,250 --> 00:02:15,310 back over. 31 00:02:15,310 --> 00:02:18,710 Now I can see the same text just like we had before. 32 00:02:18,720 --> 00:02:24,850 However if I now inspect that element I'll see that it's actually a big collection of different spans. 33 00:02:24,990 --> 00:02:30,840 And so now we can apply some styling rules like either CSX or direct styling to each individual span 34 00:02:31,200 --> 00:02:38,860 to color each one so either green red or the default black as it is right now that's kind of step one. 35 00:02:39,110 --> 00:02:43,580 Now the next thing we have to do is figure out how to actually compare each character inside of your 36 00:02:44,020 --> 00:02:44,350 eye. 37 00:02:44,360 --> 00:02:47,570 Each character that a user enters into this text input. 38 00:02:47,720 --> 00:02:51,490 That's why I mentioned at the end of last video that you might need the index. 39 00:02:51,530 --> 00:02:56,570 So as we're iterating through using energy for we need to look up the index of each letter that we are 40 00:02:56,570 --> 00:03:06,300 iterating over and we need to compare at each index using our entered text property let's try that out 41 00:03:07,560 --> 00:03:09,770 now writing this out is to be just a little bit messy. 42 00:03:09,800 --> 00:03:13,400 I'm going to zoom out for just a moment so you can see the entire line of code that I'm going to be 43 00:03:13,400 --> 00:03:14,180 working on. 44 00:03:14,390 --> 00:03:15,350 But this is too small. 45 00:03:15,350 --> 00:03:20,560 I am going to zoom back into very shortly so just for a moment I'm going to zoom out so I know first 46 00:03:20,590 --> 00:03:27,580 update my energy for a statement at the very end of it open in a semicolon and then I'll say let I equals 47 00:03:27,820 --> 00:03:29,070 index. 48 00:03:29,090 --> 00:03:34,060 So now we've got a variable I that we can refer to inside the span element anywhere inside the span 49 00:03:34,670 --> 00:03:40,530 to get an idea of what character we are currently iterating over So for right now let's try to print 50 00:03:40,530 --> 00:03:46,620 out every letter that we are iterating over with these corresponding letter out of entered text. 51 00:03:46,620 --> 00:03:52,120 We're going to print them all out inside of sets up parentheses so we can compare each them one by one. 52 00:03:52,140 --> 00:03:59,350 Visually though to do so inside a span I can to wrap that thing with a set of parentheses. 53 00:03:59,680 --> 00:04:05,520 And then after we print out letter and then going to put in another set of curly braces I'll then try 54 00:04:05,510 --> 00:04:09,870 to also print out the corresponding letter out of entered text. 55 00:04:09,890 --> 00:04:16,360 And so I going to say entered text at I am going to say this and then zoom back in really quickly so 56 00:04:16,360 --> 00:04:17,550 you can see what's going on here 57 00:04:20,490 --> 00:04:20,700 OK. 58 00:04:20,730 --> 00:04:25,830 So again I'm trying to print out one opening parentheses and then trying to print out whatever letter 59 00:04:25,830 --> 00:04:28,230 we are iterating over and then immediately after it. 60 00:04:28,230 --> 00:04:33,950 I want to print out the corresponding letter from enter text and I'm printing out a closing parentheses. 61 00:04:33,960 --> 00:04:39,300 Now I'm just doing this right now just to have a manual inspection and say yeah this is like going right 62 00:04:39,300 --> 00:04:46,060 way it's going how we expected going to say this and then look back over right away. 63 00:04:46,070 --> 00:04:48,190 I'm going to see a tremendous number of parentheses. 64 00:04:48,260 --> 00:04:53,320 And by the way you might also see a lot of spaces inside of here as well if you see spaces. 65 00:04:53,330 --> 00:04:56,790 It's probably because you've got something like this right here. 66 00:04:56,870 --> 00:05:03,080 You might have this kind of layout or your HDMI out but if you have that I see all those extra spaces 67 00:05:03,110 --> 00:05:04,220 as well. 68 00:05:04,220 --> 00:05:08,360 So in order to get rid of all those extra spaces you can do exactly what you just saw inside my code. 69 00:05:08,360 --> 00:05:17,940 Ed we're going to make sure that we've got the closing brackets of the opening tag on the same line 70 00:05:18,290 --> 00:05:24,650 and we can make sure that the opening bracket of the closing tag is on the same line as well. 71 00:05:24,760 --> 00:05:29,700 I know that looks kind of ugly but that's how we can get rid of all those extra spaces that I now flip 72 00:05:29,700 --> 00:05:30,300 back over. 73 00:05:30,300 --> 00:05:31,880 No more spaces. 74 00:05:32,070 --> 00:05:32,310 OK. 75 00:05:32,340 --> 00:05:36,060 Now back on track remember we only put in the parentheses here so we can actually compare character 76 00:05:36,060 --> 00:05:37,360 by character. 77 00:05:37,380 --> 00:05:40,290 In this case I want to type out I and V and so on. 78 00:05:40,290 --> 00:05:45,030 So I'll put an I as soon as I do I'll see that I get the same character out of the entered texturing 79 00:05:45,030 --> 00:05:53,790 inside there then n yep those are definitely identical the E and T O R E like so and so in every case 80 00:05:53,850 --> 00:05:59,520 I see the doubling up inside those parentheses which is a sign that I am correctly looking up the characters 81 00:05:59,560 --> 00:06:01,110 of the string right here. 82 00:06:01,110 --> 00:06:05,100 And I have access to them inside that energy for a statement OK. 83 00:06:05,120 --> 00:06:06,430 So now we've got this put together. 84 00:06:06,440 --> 00:06:07,770 Let's take a quick pause right here. 85 00:06:07,790 --> 00:06:11,770 When we come back the next video we're going to wrap up we're gonna make sure that we style usually 86 00:06:11,830 --> 00:06:17,180 span elements appropriately depending upon whether we've got the correct character entered inside of 87 00:06:17,180 --> 00:06:20,750 our input the quick pause and we'll take care of this in just a moment. 9643

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