WEBVTT 00:00.750 --> 00:03.480 This we are at a time deal with string. 00:03.480 --> 00:08.190 So I will be digging where you will and then start performing examples with them. 00:08.200 --> 00:15.720 So the first thing I'm digging is x is a variable and then adding Hangu on the secondary when I'm thinking 00:15.720 --> 00:19.430 is why am I doing Capital One. 00:20.300 --> 00:23.650 Since these two are string and we need to play with them. 00:23.810 --> 00:30.220 Sunbaking example with capital as of this morning does the first thing that we should talk about is 00:30.230 --> 00:36.860 escape character but that we have only talk during our date or time string section and this is one of 00:36.860 --> 00:38.370 the most important thing. 00:38.390 --> 00:41.340 The second thing we need to talk about is metal's. 00:41.420 --> 00:47.210 So before jumping with your question regarding what is matter so matter is a function that is available 00:47.270 --> 00:51.930 for a given object because of the object state that means. 00:51.960 --> 00:58.670 So if I'm taking a string string has its own matter if I'm taking list list has their own methods and 00:58.700 --> 01:05.340 if I'm thinking of what you like if I am trying to import mad that means math will have their own function 01:05.600 --> 01:08.330 and then the function will have their own atoms. 01:08.360 --> 01:14.060 So let's not make things complicated just understand that matter is a function. 01:14.060 --> 01:15.990 So if we are using string. 01:16.100 --> 01:21.680 So these matter will be related to string if we want to use list dishnet eatable. 01:21.710 --> 01:23.720 So there will be different Minturn's. 01:23.720 --> 01:26.210 Each object will have their own matter. 01:26.210 --> 01:28.030 Let us begin with the example. 01:28.220 --> 01:31.940 So let me do the simplest thing to get our little move forward. 01:32.080 --> 01:34.140 So one going to print x and y. 01:34.490 --> 01:37.410 So if I run this basic code you can see my output. 01:37.550 --> 01:39.600 Now we need to start using method. 01:39.730 --> 01:46.860 So to use a method on a string or on any variable all you have to do is often that very well at a dot 01:47.240 --> 01:51.780 and then you can see different type of matters that are available. 01:51.900 --> 01:57.590 We are using an ID that is atom and it has its own intellisense. 01:57.620 --> 02:00.290 So that means it will give me some commands. 02:00.290 --> 02:02.720 It will help me to select these thing. 02:02.840 --> 02:09.230 If you are using pajamas you'll also get a similar list but if you're using any other reader or maybe 02:09.250 --> 02:13.110 notepad on the command line you might miss this thing. 02:13.330 --> 02:18.140 So if I'm using X dog now I can see different type of metals. 02:18.260 --> 02:21.600 And this method will help us to format our string. 02:21.860 --> 02:26.340 So firstly let me take the basic thing that is capitalized. 02:26.570 --> 02:35.210 And if I use this particular matter remember whenever we use any method or function we need to use open 02:35.210 --> 02:39.250 fantasies and closing parentheses after that particular keyword. 02:39.440 --> 02:49.860 So where I'm using capitalized for my X and my and if I have green Reserve now you can see what it has 02:49.870 --> 02:53.200 done is it has changed my string. 02:53.260 --> 02:57.980 Now the first letter is changed into capital and the rest are small. 02:58.090 --> 03:06.010 So if I have a paragraph that means if I had a lot more strings maybe after a full stop and if I see 03:06.010 --> 03:13.380 that and underscored again you can see only the first a capital letter and restarts more. 03:13.390 --> 03:16.160 So this one is one of the most basic matter. 03:16.340 --> 03:23.570 So here let me delete this now and the second method that I need to talk about is upper and lower. 03:23.630 --> 03:29.420 So by the name itself you can guess upper means that it might change all the string in capital letters 03:29.780 --> 03:32.540 and new or mean that my jeans string. 03:32.660 --> 03:36.150 That means all the characters into small letters. 03:36.230 --> 03:38.660 So let us try next door. 03:38.720 --> 03:48.000 Now I need to write a paper on for a while let me write LOL And let me run this one. 03:48.000 --> 03:54.580 You can see what actually happened is not X is all capitals and Y is also more letters. 03:54.780 --> 04:00.040 So it just converted all our alphabet into cap letters. 04:00.210 --> 04:05.520 So if I try to use capital H I'm still going to get the same result. 04:05.520 --> 04:08.120 The next thing I want to talk about is indexing. 04:08.370 --> 04:15.050 So if you want to get a point equal a caterpillar from this string then we can use indexing. 04:15.240 --> 04:22.560 So if I use square brackets and if I define zero that is my index position and you must remember that 04:22.650 --> 04:24.920 indexing starts with zero. 04:24.930 --> 04:30.810 So if x is zero that means the zero position of this particular string. 04:30.960 --> 04:39.500 So here I'm going to get a result of H and never talk about why five so I'm going to get a result off. 04:39.570 --> 04:40.330 Guess what. 04:40.450 --> 04:41.840 Oh let me try this one. 04:46.650 --> 04:51.720 So you can see I got the result of edge and I got space. 04:51.720 --> 05:02.820 So that means space is also included in my character and if H is zero e is 1 2 3 or 4 and then space 05:02.820 --> 05:03.520 is 5. 05:03.720 --> 05:06.480 So I got the result as H and blank. 05:06.750 --> 05:10.420 So indexing is really important to fetch characters. 05:10.600 --> 05:14.070 But I'm only trying to fetch a single character. 05:14.100 --> 05:17.070 What if I need to fetch or substring. 05:17.100 --> 05:18.200 That means if there is. 05:18.240 --> 05:20.660 Hello world I just want info. 05:20.760 --> 05:22.370 So how can I do that. 05:22.440 --> 05:24.120 So this is called slicing. 05:24.120 --> 05:31.800 That means I want a particular section of a string so that the same open bracket you can define from 05:31.800 --> 05:37.920 which point to which one that is from which indexing position to which indexing position you want to 05:37.920 --> 05:39.080 get the substring. 05:39.210 --> 05:53.050 So if I define from 0 to 5 and maybe from zero to three if I find this and someone you can see for the 05:53.050 --> 05:56.020 first variable that is x I've got Hello. 05:56.230 --> 06:00.880 So it started from zero indexing position and fetchmail food. 06:01.090 --> 06:03.620 And the second is zero. 06:03.730 --> 06:11.140 That is why variable started from zero and exposition and fetch the second index magician. 06:11.290 --> 06:13.960 Remember I am focusing on an expedition. 06:14.020 --> 06:21.010 So if I'm talking about zero to treat that means 0 1 and 2 adding the word 3 is not included. 06:21.100 --> 06:29.440 If I'm talking about 0 to 5 that means 0 1 2 3 4 dispositions are included and 5 to 1 is not included. 06:29.470 --> 06:32.530 So this process is called as slicing. 06:32.530 --> 06:36.500 So let me clear this up and let me start with more metals. 06:36.610 --> 06:44.140 So if I add spaces in my string maybe unknown amount of space at Left-Right and hard trying to save 06:44.140 --> 06:50.900 this one and if I want to strip them all I need to do is use Ostap mentor. 06:50.920 --> 06:54.720 So where do you start and then write them into name. 06:54.730 --> 07:01.690 So if I select this one I might open those in parentheses and if I tried to on this one you can see 07:01.690 --> 07:10.920 I still got a result of Helloween and if I try to print the same result with this matter you can see 07:10.920 --> 07:12.730 the result is totally different. 07:12.900 --> 07:14.420 So this is really important. 07:14.550 --> 07:17.210 You can also try different words off-Strip. 07:17.250 --> 07:18.810 The first is extra. 07:18.850 --> 07:20.580 That means left straight. 07:20.580 --> 07:24.140 And the second one is Ostap that means right Strip. 07:24.180 --> 07:26.960 So let me try and get that inside. 07:29.960 --> 07:36.370 And if I run this one so you can see in the Wizard the left part of space is strip. 07:36.530 --> 07:39.940 And the second reason and the right part is strip. 07:40.160 --> 07:42.170 So this is quite useful. 07:42.170 --> 07:44.880 The next thing I need to talk about is cushioning. 07:44.930 --> 07:51.260 So if you have a part of the string we need to check if all the characters in the available string are 07:51.280 --> 07:54.460 a noble character we can do that in one matter. 07:54.650 --> 07:59.530 Or if I need to check if all characters have characters that means capitalized. 07:59.600 --> 08:02.240 In this particular string we can use that. 08:02.480 --> 08:10.110 So let me just you these hand use my symbol one in shock and you use the Huisman string. 08:10.130 --> 08:15.380 All you have to do is use is and then you can see all the examples. 08:15.540 --> 08:19.470 Let me take what is to hold and get the second one. 08:19.870 --> 08:30.310 I would take away the word and let me use is upper let me clear this up and on my screen again you can 08:30.310 --> 08:31.030 see I just scored. 08:31.120 --> 08:37.720 Drew Drew for both of them that means X has all the new characters and Y has all of our characters. 08:37.840 --> 08:41.830 And if I tried to g a single word that is a single character and then 08:47.390 --> 08:50.400 these guys are going to change in two forms. 08:52.000 --> 08:55.420 So I hope this time the opening thing. 08:55.420 --> 09:00.370 That is how we can judge our string how we can check our string. 09:00.370 --> 09:02.950 The next thing I need to talk about is replacing. 09:03.160 --> 09:09.580 So while I'm printing some sort while displaying some worth of characters we might need to replace them 09:09.940 --> 09:12.900 so that we can use the place. 09:13.240 --> 09:18.500 So with this replace matter I need to pass which character I need to replace. 09:18.520 --> 09:28.070 So here if I replace it with as and print out the result you can see it is replaced with more depth. 09:28.150 --> 09:30.620 There are several characters that are available. 09:30.730 --> 09:32.590 So let me eat or. 09:33.380 --> 09:39.100 And if I try to run this one you can see on the all that are available in the spring will be replaced 09:39.160 --> 09:40.350 by S. 09:40.660 --> 09:47.720 Maybe I need to replace a word and the way we're only doing with characters maybe replace world leaders 09:47.830 --> 09:55.670 during and let me try to run this one so you can see it's not the place because we were using capital 09:55.670 --> 10:04.140 W and if I tried to use more of new and this one you can see the beast so we can replace a word we can 10:04.140 --> 10:10.020 replace a character using the placement are the next thing I need to talk about display. 10:10.280 --> 10:12.120 And I'm really really short. 10:12.260 --> 10:17.870 Whatever project you are going to do whatever for the things you are going to do with Python you are 10:17.870 --> 10:21.230 going to use it at some point of time. 10:21.320 --> 10:23.680 So let me first edit my string. 10:23.720 --> 10:29.950 So suppose there is a on my string and I want to split the string into two parts. 10:30.080 --> 10:31.720 With this particular comma. 10:31.760 --> 10:38.510 So all I have to do is use the Split function and then define that character by which I need to divide. 10:38.690 --> 10:42.290 So if I need to divide with Komarr use a comma. 10:42.560 --> 10:45.940 Let me clear this up from this fine. 10:46.030 --> 10:49.050 You can see I just quartos word of hello and one. 10:49.150 --> 10:51.690 So this is actually on my list. 10:51.950 --> 10:55.920 OK that's fine but what if I need to do something else. 10:55.930 --> 11:03.570 Let me try and space move this space. 11:03.690 --> 11:04.440 This file. 11:05.560 --> 11:09.040 You can see I'm still able to get my help in one. 11:09.250 --> 11:16.150 So the result will be always in our list and I'm getting a split off hello and one so far and multiple 11:16.150 --> 11:20.870 characters and trying to run this one again. 11:21.200 --> 11:25.950 You can see I'm having a result with 4 items in my list. 11:25.950 --> 11:30.680 So this was quite important and the last small thing that I want to talk about. 11:30.780 --> 11:32.680 Because the string is really big. 11:32.760 --> 11:34.910 You can try to play with number of amateurs. 11:34.920 --> 11:37.220 I just use important mentors. 11:37.230 --> 11:40.710 There are some hundreds of matter and you will start using them. 11:40.710 --> 11:42.780 Start to lose their importance. 11:42.870 --> 11:47.780 Once you start working on any project or you start getting stuck on some point. 11:48.030 --> 11:50.810 So no one is going to use hundreds method. 11:50.820 --> 11:52.920 These are some really important matter. 11:52.950 --> 11:59.370 The meaning 100 meter you might never use or you might use once in a year to totally depend on what 11:59.370 --> 12:01.450 you are willing to work in future. 12:01.650 --> 12:05.340 The next small thing that I need to talk about is multiplication. 12:05.340 --> 12:12.510 So if I need to print something 100 times maybe I want to print this way hundred times all I have to 12:12.510 --> 12:18.160 do is use my VI and then use my string symbol and then 100. 12:18.270 --> 12:25.410 That means I'm multiplying it 400 times and if I print this it's going to print Hello World 100 times 12:25.680 --> 12:26.530 to most. 12:26.580 --> 12:33.010 I need to add a space here that will be better and I can change just one as I know. 12:33.150 --> 12:40.800 OK let's run this one and I'm having here one 400 names so that all four string. 12:40.830 --> 12:45.430 These are some really important thing and you can do a lot more stuff with string. 12:45.480 --> 12:47.420 Once we start in in project. 12:47.640 --> 12:49.260 So that's all for this lecture. 12:49.260 --> 12:50.720 See you in the next one.