1
00:00:02,800 --> 00:00:03,370
Hi everyone.

2
00:00:03,450 --> 00:00:11,070
So in this lesson we are going to learn what is a string class so we started about object oriented programming.

3
00:00:11,080 --> 00:00:13,480
And we know what is the meaning of a class.

4
00:00:13,480 --> 00:00:19,660
So stringers in the class but we can use a string as if it is only to type.

5
00:00:19,660 --> 00:00:21,520
So what do I mean by the type.

6
00:00:21,520 --> 00:00:26,750
So basically what you can do you can write something like this string due to type.

7
00:00:26,950 --> 00:00:31,900
The name is s and let's say ABC so here.

8
00:00:31,950 --> 00:00:33,760
String is behaving as a data type.

9
00:00:33,780 --> 00:00:38,480
That's why I told you that we can use the string as a data type symbol.

10
00:00:38,580 --> 00:00:42,110
So string actually behaves like the correct binary.

11
00:00:42,370 --> 00:00:45,010
But what is the problem with the correct bearings.

12
00:00:45,030 --> 00:00:50,490
So the problem is basically we have to always take it off null corrector so disconnected.

13
00:00:50,760 --> 00:00:54,600
But this is not the problem with strings.

14
00:00:54,600 --> 00:00:56,580
So let's see how we can use the strings

15
00:01:00,410 --> 00:01:01,730
so let's create a String

16
00:01:05,600 --> 00:01:10,670
String s let's say it is containing ABC and then you can do a string

17
00:01:14,010 --> 00:01:14,610
so let's see

18
00:01:18,880 --> 00:01:20,650
so ABC is getting printed

19
00:01:26,470 --> 00:01:27,360
now.

20
00:01:27,840 --> 00:01:37,090
You can also do like this so it does create one more string string as to and you can write like this

21
00:01:37,090 --> 00:01:42,330
so as to is the E F and now let us print as to

22
00:01:48,160 --> 00:01:54,890
so ABC and the F so basically you can also clear distinct dynamically.

23
00:01:54,890 --> 00:02:02,760
So here we are creating strings statically let us now create string dynamically so String start String

24
00:02:02,760 --> 00:02:03,320
pointed.

25
00:02:03,390 --> 00:02:04,680
This is new string

26
00:02:08,080 --> 00:02:19,100
and now let us give the values so start SB let's say it is and then no.

27
00:02:19,210 --> 00:02:24,490
Now what will be my output the fine print SB So the output will be addressed if you want to print the

28
00:02:24,490 --> 00:02:26,120
content you have to use Start.

29
00:02:26,210 --> 00:02:30,350
Start SB and then you will get the content.

30
00:02:30,400 --> 00:02:37,630
So let's see.

31
00:02:37,700 --> 00:02:40,690
So this is the address and this is the content.

32
00:02:40,720 --> 00:02:45,880
So you have to give a start for printing the content and if you would not give the defense operator

33
00:02:46,380 --> 00:02:48,240
it will bring to the ad bus.

34
00:02:48,400 --> 00:02:53,340
So this is stored in hexadecimal format.

35
00:02:53,350 --> 00:02:56,390
Now suppose you want to store multiple strings.

36
00:02:56,770 --> 00:03:02,560
So in that case if you do not know string how we list or multiple strings so you have to create a 2D

37
00:03:02,560 --> 00:03:03,970
array of characters.

38
00:03:04,090 --> 00:03:12,320
So get a and then you have to create that to the area of characters under the cross hundred and in this

39
00:03:12,320 --> 00:03:13,210
hundred across hundred.

40
00:03:13,220 --> 00:03:16,400
Basically your first instinct will be stored here.

41
00:03:16,590 --> 00:03:17,620
Zero to 99.

42
00:03:17,750 --> 00:03:20,510
Then your second string then your third string and so on.

43
00:03:20,510 --> 00:03:22,560
So this is not a good V.

44
00:03:22,720 --> 00:03:29,920
The good ways what you can do you can write that rough string string is going to behave as a data type

45
00:03:29,920 --> 00:03:31,540
so you can write like this.

46
00:03:31,540 --> 00:03:32,550
So what will happen.

47
00:03:32,680 --> 00:03:42,100
You will get the vector and each and every of vector is basically a string so each every effect is going

48
00:03:42,100 --> 00:03:47,430
to be a string so this thing is much much powerful than this.

49
00:03:47,430 --> 00:03:51,920
Rudy Eddie because you are using string and you're also using vector.

50
00:03:51,940 --> 00:03:54,970
So basically you have palette of a string function.

51
00:03:55,210 --> 00:03:59,230
All the function of string class and you have power of all the function of the vector class.

52
00:04:00,490 --> 00:04:02,830
So let's see.

53
00:04:02,830 --> 00:04:04,540
So let us create a duty area.

54
00:04:04,570 --> 00:04:09,670
So for creating the 380 we will always write like this vector string v.

55
00:04:09,940 --> 00:04:13,480
And for pushing one element what we have to do you have to push a string.

56
00:04:13,480 --> 00:04:22,610
So let us push the content so we don't push back let's say I want to insert this string as so we don't

57
00:04:22,610 --> 00:04:23,080
push back.

58
00:04:23,090 --> 00:04:27,280
You can write s let does insert one more string.

59
00:04:27,320 --> 00:04:30,410
Let's say you dot back

60
00:04:33,690 --> 00:04:37,440
Hello and similarly you can print the content.

61
00:04:37,460 --> 00:04:39,530
So avoid printing the content.

62
00:04:39,680 --> 00:04:42,830
You just have to iterate over the vector.

63
00:04:42,830 --> 00:04:52,170
So I equals zero I list and we dot size so vector has a function and then you can print the content.

64
00:04:52,450 --> 00:05:00,410
So vilify BFI is actually a string so let's see okay.

65
00:05:00,430 --> 00:05:01,820
So we have to include vector

66
00:05:14,330 --> 00:05:19,010
so you can see ABC as this one s and then we inserted Hello.

67
00:05:19,100 --> 00:05:21,760
So vector of string is behaving as if to the Eddie

68
00:05:26,410 --> 00:05:26,660
okay.

69
00:05:26,670 --> 00:05:31,590
So what else can we do so you're inserting the elements.

70
00:05:31,620 --> 00:05:34,110
You can also call the function sort.

71
00:05:34,200 --> 00:05:38,010
So when you first you print this element then let us start.

72
00:05:38,010 --> 00:05:40,410
So how you will sort V of I.

73
00:05:40,440 --> 00:05:42,090
So what is vilify is a string.

74
00:05:42,600 --> 00:05:49,770
So you will give the unified out begin and you will give vilify is a string so you will give.

75
00:05:49,790 --> 00:06:07,020
We'll find out and and now let us bring to vilify you again.

76
00:06:07,090 --> 00:06:09,910
Let's see what is data so it was not declared in this globe.

77
00:06:09,940 --> 00:06:17,730
Okay so this sort function this and world start function is declared in a library so let us include

78
00:06:18,200 --> 00:06:19,230
that library until

79
00:06:25,050 --> 00:06:26,210
now led to an output well

80
00:06:32,770 --> 00:06:40,440
so ABC after starting ABC it is still ABC because the alphabet s sorted according to the Lexx a graphical

81
00:06:40,450 --> 00:06:41,240
minus.

82
00:06:41,260 --> 00:06:43,690
So HLA low after sorting.

83
00:06:43,900 --> 00:06:45,400
So what is happening here.

84
00:06:47,500 --> 00:06:49,830
So first you string was ABC.

85
00:06:49,960 --> 00:06:56,530
So if you will start ABC then it will become ABC only because A's less than B B's latency.

86
00:06:56,530 --> 00:06:58,940
So in this way the alphabets are getting sorted.

87
00:06:59,200 --> 00:07:01,870
Now if you want to sort Hello.

88
00:07:01,870 --> 00:07:03,030
So which one is the smallest.

89
00:07:03,070 --> 00:07:07,000
So even the smallest so even come at first then etch.

90
00:07:07,240 --> 00:07:09,880
Then similarly n n and then.

91
00:07:10,180 --> 00:07:13,560
So after sorting hello will become this one.

92
00:07:13,960 --> 00:07:18,030
So basically you can start your judiciary what we are doing.

93
00:07:18,030 --> 00:07:20,560
We can sort out what connected to the array.

94
00:07:20,580 --> 00:07:26,130
So if you want to sort of connected all the array it will be difficult but let's see it is so much easy.

95
00:07:26,130 --> 00:07:29,670
If you're using that trusting for creating a doody area of characters

96
00:07:34,160 --> 00:07:38,980
now let's do some more functions of string so we can take input.

97
00:07:39,340 --> 00:07:44,010
So far digging in let us create when most things String s three.

98
00:07:44,420 --> 00:07:47,390
So string as tree and we can take input.

99
00:07:47,540 --> 00:07:51,620
So seen as tree and let us well so print as tree

100
00:07:58,870 --> 00:08:00,310
so it is waiting for my input.

101
00:08:00,330 --> 00:08:09,750
Let's say the input is calling and the output is calling Let's now put out one more time so again it

102
00:08:09,750 --> 00:08:10,970
is waiting for my input.

103
00:08:10,980 --> 00:08:18,180
Let's say the input is do space according but this time it is taking on you do.

104
00:08:18,210 --> 00:08:20,970
So we have seen this problem before.

105
00:08:20,980 --> 00:08:22,490
So what is the problem.

106
00:08:22,490 --> 00:08:29,120
So the problem is due to see in seeing is creating all the problems because scene will stop taking good

107
00:08:29,120 --> 00:08:29,500
input.

108
00:08:29,510 --> 00:08:37,690
As soon as it will encounter space or tabs all basically new land connected.

109
00:08:37,770 --> 00:08:41,530
So this is seen as the problem in this case.

110
00:08:41,530 --> 00:08:43,650
Now if you remember what is the solution.

111
00:08:43,650 --> 00:08:47,550
So the solution is using the function C in dark get lean.

112
00:08:47,630 --> 00:08:53,660
Now this function is seen or good main function takes three bottom which is as input String name.

113
00:08:54,100 --> 00:08:59,710
The second one is size and the detector the better midday is actually optional which is dealing with

114
00:08:59,710 --> 00:09:03,670
the if you remember now in this case.

115
00:09:03,670 --> 00:09:11,200
So this was the situation when we were using connectivity but here what we are using we are using strings.

116
00:09:11,200 --> 00:09:17,200
So what I will write a C not good line is as is basically my string.

117
00:09:17,200 --> 00:09:18,450
Now the third parameters option.

118
00:09:18,460 --> 00:09:21,820
But what number the second parameter What about size.

119
00:09:21,820 --> 00:09:26,540
So this is the property of a string class that you do not know the size.

120
00:09:26,560 --> 00:09:28,990
Basically you can give anything as input.

121
00:09:29,020 --> 00:09:30,900
You do not have to worry about sites.

122
00:09:30,910 --> 00:09:34,090
So basically I cannot use seem not good line function.

123
00:09:34,090 --> 00:09:34,960
So let me show you

124
00:09:38,060 --> 00:09:41,840
so instead of scene so something is wrong.

125
00:09:41,840 --> 00:09:46,830
If I will use scene or good line function S3.

126
00:09:46,930 --> 00:09:53,140
Now this second parameter is actually size but we do not know the size that is the property of the string

127
00:09:53,140 --> 00:09:54,350
class.

128
00:09:54,550 --> 00:09:56,500
That is the advantage of the string class.

129
00:09:56,500 --> 00:09:58,440
Basically you can give anything as input.

130
00:09:58,450 --> 00:10:00,040
You do not have to worry about what size.

131
00:10:00,040 --> 00:10:02,250
You do not have to worry about no character.

132
00:10:02,290 --> 00:10:06,550
So that means I cannot use seemed or get named function.

133
00:10:06,550 --> 00:10:13,390
So fostering class we have the function we will write it like this get line take input from scene and

134
00:10:13,390 --> 00:10:14,770
put the input in s.t..

135
00:10:16,030 --> 00:10:22,500
So this is the V for taking input for taking input of space kind basically spaces will be there.

136
00:10:22,540 --> 00:10:23,980
So I have to write like this.

137
00:10:23,980 --> 00:10:28,390
Get Lane take input from scene and put the input in history.

138
00:10:28,420 --> 00:10:36,720
So let's see now this time if you will give input like do space according.

139
00:10:36,990 --> 00:10:39,750
So our output is correct.

140
00:10:39,760 --> 00:10:40,010
Okay.

141
00:10:40,020 --> 00:10:41,500
So this is working now.

142
00:10:41,610 --> 00:10:42,940
So we have to use get.

143
00:10:43,140 --> 00:10:46,320
And you can remember this and fix it is very simple syntax

144
00:10:49,070 --> 00:10:53,890
so we do not have to worry about the length of the string you do not have to worry about it connected.

145
00:10:54,140 --> 00:10:56,570
So everything is working perfectly fine.

146
00:10:56,570 --> 00:10:59,890
Now you can do it strings as if it is an eddy.

147
00:10:59,900 --> 00:11:01,950
So what do I mean Barrie.

148
00:11:02,000 --> 00:11:09,360
So after taking the input let us say I am I want to change my string so I can write like this as trees.

149
00:11:09,380 --> 00:11:11,270
Let's say it is

150
00:11:14,230 --> 00:11:16,160
ABC ABC.

151
00:11:16,420 --> 00:11:18,370
Let's say this is my new string.

152
00:11:18,490 --> 00:11:21,180
So what do I mean by.

153
00:11:21,280 --> 00:11:23,380
So you can access it like this.

154
00:11:23,380 --> 00:11:24,970
What is the first character.

155
00:11:25,030 --> 00:11:28,080
What is the character represented the first 16.

156
00:11:28,270 --> 00:11:30,820
So it will be be selectee

157
00:11:34,780 --> 00:11:36,560
OK so it is waiting for my input.

158
00:11:36,580 --> 00:11:38,260
So do coding.

159
00:11:38,260 --> 00:11:42,880
Now the first correct is actually be why it is being because after taking the input from the user you

160
00:11:42,880 --> 00:11:48,250
are changing the way live S3 it is ABC ABC and the first connect is actually B.

161
00:11:48,310 --> 00:11:56,040
So you can treat your strings like if it is an integer area and like it like it isn't any so it will

162
00:11:56,040 --> 00:11:57,990
ask me for the input again and again.

163
00:11:57,990 --> 00:12:01,840
So let this come into doubt manner.

164
00:12:01,860 --> 00:12:06,660
This one's going down this line.

165
00:12:06,870 --> 00:12:07,100
OK.

166
00:12:07,120 --> 00:12:11,710
So if you can access that obviously mean you can change the value also.

167
00:12:12,580 --> 00:12:15,050
So there does change the value.

168
00:12:15,220 --> 00:12:18,350
So let us change the 0 8 character.

169
00:12:18,710 --> 00:12:20,830
The correct purpose in the data index.

170
00:12:20,980 --> 00:12:24,340
Let's say I want to make a deal so we can definitely do it.

171
00:12:24,400 --> 00:12:29,620
We can do testing as if it does entity and now let's print as three

172
00:12:37,520 --> 00:12:40,040
so the zero character has been changed.

173
00:12:40,040 --> 00:12:41,380
It was initially.

174
00:12:41,450 --> 00:12:42,180
Now it is.

175
00:12:42,200 --> 00:12:45,380
So BBC and ABC you can see.

176
00:12:45,380 --> 00:12:47,660
So this is BBC and ABC.

177
00:12:47,690 --> 00:12:53,390
So my zealot character is now the.

178
00:12:53,500 --> 00:12:55,030
So what else can we do.

179
00:12:55,210 --> 00:12:56,920
So we can add two strings.

180
00:12:56,980 --> 00:12:58,390
So what is the meaning of two strings.

181
00:12:58,390 --> 00:13:00,360
What is the meaning of adding two strings.

182
00:13:00,400 --> 00:13:02,350
So let us create when most interesting guess what.

183
00:13:02,410 --> 00:13:07,780
And you can write it like this string three plus.

184
00:13:07,900 --> 00:13:18,370
So this is String s so let's add these two strings so distinctly plus string as do we have another string.

185
00:13:18,880 --> 00:13:20,760
OK so let's take it as two.

186
00:13:20,920 --> 00:13:25,150
So string so S4 is is three places too.

187
00:13:25,180 --> 00:13:26,380
Now what will happen.

188
00:13:26,380 --> 00:13:30,750
So these two things will get added and the output will be stored in a string as food.

189
00:13:31,000 --> 00:13:40,860
So let us write it like this C out as for and let us also print as 20 30 so as to

190
00:13:46,310 --> 00:13:46,860
as 3

191
00:14:02,450 --> 00:14:03,990
so let's cut it from here.

192
00:14:08,530 --> 00:14:09,760
And let's be started

193
00:14:17,830 --> 00:14:18,110
okay.

194
00:14:18,120 --> 00:14:22,590
So I'm using this plus operator to add a string as tree and string as two.

195
00:14:22,620 --> 00:14:29,190
So this is your string s2 which is the F and this is your string as T.

196
00:14:29,190 --> 00:14:31,050
So this is ABC ABC.

197
00:14:31,050 --> 00:14:32,480
So let's see what we had output

198
00:14:35,570 --> 00:14:35,810
okay.

199
00:14:35,820 --> 00:14:38,780
So let's come on get out.

200
00:14:38,780 --> 00:14:40,130
Let's remove string.

201
00:14:40,190 --> 00:14:41,390
Let's put this cord about

202
00:14:59,610 --> 00:15:03,400
so you are printing as to get printing as three and you are printing as fold.

203
00:15:03,510 --> 00:15:09,870
So what is as true as true is you can see the e f so S2 is the f what is s 3.

204
00:15:09,900 --> 00:15:17,940
So it is ABC ABC and you are changing these character to these two string as three is actually D B.C.

205
00:15:18,210 --> 00:15:23,730
and ABC and then what they are doing so as three plus S2.

206
00:15:23,740 --> 00:15:28,320
So this plus operator what it will do so as three plus as two.

207
00:15:28,390 --> 00:15:31,600
So this plus operator will look as concatenation.

208
00:15:31,600 --> 00:15:36,910
So it will concatenate a string s2 at the back of string S3.

209
00:15:36,910 --> 00:15:46,330
So this D F will come at the back off string as t but but this plus operator will lose so it will add

210
00:15:46,450 --> 00:15:50,680
it will find out the desert and it will get done that isn't so that is it is going to be stored in as

211
00:15:50,690 --> 00:15:53,170
food so as true and as true.

212
00:15:53,170 --> 00:15:54,680
So there will be no change for the.

213
00:15:54,680 --> 00:16:00,460
TIM LESTER You can see so you're this is you are as to which is the F correct.

214
00:16:00,460 --> 00:16:03,230
This is u s team which is a BBC ABC.

215
00:16:03,240 --> 00:16:05,400
So this is BBC and ABC.

216
00:16:05,410 --> 00:16:07,890
So it is correct and this is why this string is full.

217
00:16:08,050 --> 00:16:16,090
So the string s what it is actually BBC ABC and then B if they get appended the E F so this plus operator

218
00:16:16,240 --> 00:16:22,000
can concatenate two strings and there will be no effect on S3 on S2.

219
00:16:22,000 --> 00:16:26,710
So this plus operator will find out the desert and it will get done that result and that result we are

220
00:16:26,710 --> 00:16:30,410
storing in a string as food correct.

221
00:16:30,550 --> 00:16:34,950
So that is the pilot of string class began simply with the help of this plus operator.

222
00:16:34,960 --> 00:16:36,730
We can just add two strings

223
00:16:41,830 --> 00:16:42,820
so we can add two strings.

224
00:16:42,820 --> 00:16:44,490
We can also add a multiple strings.

225
00:16:44,500 --> 00:16:46,540
So for example you can write or tell

226
00:16:51,410 --> 00:16:53,270
you can write it like this also so let's see

227
00:16:58,040 --> 00:16:59,250
so this is your output.

228
00:16:59,250 --> 00:17:01,790
This is your string as for ABC.

229
00:17:01,850 --> 00:17:08,570
ABC the F Hello space calling so that is the power of string plus.

230
00:17:08,750 --> 00:17:11,740
Now you can also write it like this where you can do

231
00:17:17,990 --> 00:17:26,530
so what you can do initially you string for initially listing phone is actually empty it is.

232
00:17:26,530 --> 00:17:34,810
It is an empty string it is not containing anything then you can write it like this as food plus equals

233
00:17:34,810 --> 00:17:35,320
two.

234
00:17:35,410 --> 00:17:39,930
So I can also use this object and plus it goes to so let's see

235
00:17:45,090 --> 00:17:51,670
so this is your output so see you can use plus equal to operator also.

236
00:17:51,890 --> 00:17:57,740
Now what is happening in this situation what you are doing you are using plus it goes to operator.

237
00:17:57,780 --> 00:17:59,270
So what is the meaning of this line.

238
00:17:59,400 --> 00:18:05,890
So as what equals as food plus as T plus as two plus.

239
00:18:05,910 --> 00:18:14,090
And then you have this very long string Hello space calling now what is happening in so this hello space

240
00:18:14,090 --> 00:18:19,830
coding will get appended after as to another combined desert of to place according will get appended

241
00:18:20,430 --> 00:18:27,680
at S3 behind the back of at the back end of history and not combine Düsseldorf s three plus has Duplass

242
00:18:27,710 --> 00:18:35,160
Hello coding will get appended after s fold and s what is actually empty string so this is empty string

243
00:18:35,250 --> 00:18:39,540
so we also have a function size let does try to print the size

244
00:18:45,400 --> 00:18:52,090
so let us try to print these days so c out you can call size function lets say I want to call this a

245
00:18:52,090 --> 00:18:54,460
functional as food so as for dot size

246
00:18:57,980 --> 00:19:06,590
are you also have the function as dark lint so as food Nordland so dark land and dark sides both the

247
00:19:06,590 --> 00:19:11,690
functions I assume they will give you the same output so you can use any function you can use sites

248
00:19:11,690 --> 00:19:15,140
function or you can use lend function that they both have same

249
00:19:20,700 --> 00:19:23,470
so you can see 21 and 21.

250
00:19:23,520 --> 00:19:26,820
So this is drawing different characters.

251
00:19:26,820 --> 00:19:28,350
So these are 21 characters

252
00:19:32,100 --> 00:19:35,070
okay so what other functions do we have.

253
00:19:35,070 --> 00:19:43,380
We have one more function and the name of that function is substring so we're digging to do as food

254
00:19:43,470 --> 00:19:50,040
dot sub string so this substring function will take the index.

255
00:19:50,130 --> 00:19:53,240
So let's say I'm giving index 3.

256
00:19:53,470 --> 00:20:04,190
So what this substring function will do so suppose this is your string ABC ABC.

257
00:20:04,200 --> 00:20:11,580
And if you call the function as DART sub SDR so say Bestia means substring and it will give the index.

258
00:20:11,580 --> 00:20:13,890
So I want to give the index three.

259
00:20:13,890 --> 00:20:15,570
So what will happen this is the index 0.

260
00:20:15,570 --> 00:20:16,260
This is index 1.

261
00:20:16,260 --> 00:20:18,110
This is a mixed two and this is index three.

262
00:20:18,270 --> 00:20:21,900
So starting from index three till the end it will give me everything.

263
00:20:21,900 --> 00:20:27,050
So it will give me ABC this will be the output.

264
00:20:27,110 --> 00:20:36,210
Now if this is your string let's say this is ABC and if you call the function as DART said Bestia and

265
00:20:36,240 --> 00:20:39,040
if you will give index 0.

266
00:20:39,210 --> 00:20:47,840
So starting from index 0 till the end it will give you the output so the output will be ABC starting

267
00:20:47,840 --> 00:20:53,350
from the index 0 in the last index it will give you all the characters.

268
00:20:53,480 --> 00:21:03,080
So that is the meaning of substring Okay so let's check our substring function so I'm calling the substring

269
00:21:03,080 --> 00:21:10,070
function on S4 so starting from index 3 there is a last index it will give me all the characters so

270
00:21:10,070 --> 00:21:11,360
let's see where do you get output

271
00:21:15,700 --> 00:21:24,250
so the size is 21 now what is indexed to you so the index 3 starts from E so starting from a till the

272
00:21:24,250 --> 00:21:31,540
last it is giving me everything you can see it is starting from ABC ABC the F and then held accordingly

273
00:21:31,540 --> 00:21:34,660
so starting from index 3 I have given index 3 here.

274
00:21:34,930 --> 00:21:40,840
So starting from index 3 to the last index or don't give me all the characters so it is giving me all

275
00:21:40,840 --> 00:21:43,810
the characters.

276
00:21:44,170 --> 00:21:50,820
Now there is one more variation of substring function so what is the second variation.

277
00:21:50,820 --> 00:21:53,550
So in the second version what do we do.

278
00:21:53,670 --> 00:21:57,770
So in this I am giving only one value as input.

279
00:21:57,960 --> 00:22:03,510
Now in the second variation you will call the function sub estimate you will give the starting index

280
00:22:03,600 --> 00:22:07,020
and you will give me how many characters do I need.

281
00:22:07,020 --> 00:22:09,090
So here what I am doing.

282
00:22:09,090 --> 00:22:13,230
Started from index 3 and give me three characters.

283
00:22:13,260 --> 00:22:17,980
So basically it will give you the character presented index three it will give you the character present

284
00:22:17,990 --> 00:22:27,680
at index 4 it will give you the character as in the next five because the land has to be three not for

285
00:22:27,680 --> 00:22:34,960
example if you will call the function as dark so best so start giving me characters starting from index

286
00:22:34,970 --> 00:22:43,120
0 and give me two characters so the output of this line will be b because this is 0 corrected.

287
00:22:43,130 --> 00:22:48,860
This is one character and so it will give you the character present at 0 index no character plays in

288
00:22:48,860 --> 00:22:54,580
that one index because I have to give only two characters because the Lent is too so Eby will be my

289
00:22:54,580 --> 00:22:55,820
output.

290
00:22:56,060 --> 00:22:57,290
Now one more thing.

291
00:22:57,290 --> 00:23:02,520
So this substring function it will not change my string it will just return me the substring.

292
00:23:02,570 --> 00:23:09,820
So basically you can do something like this as two is as Dot Sebastian zero comma do.

293
00:23:09,980 --> 00:23:15,190
So this substring function it does not change the original listing in fact it returns the new string.

294
00:23:15,470 --> 00:23:16,160
So let's see

295
00:23:23,150 --> 00:23:30,130
so starting from so starting from the third character starting from the third index.

296
00:23:30,450 --> 00:23:35,440
Give me five characters so let's see where do you get output

297
00:23:41,120 --> 00:23:44,290
so this was.

298
00:23:44,430 --> 00:23:50,750
So this is the five characters starting from index three so e b c the NDE.

299
00:23:51,030 --> 00:23:52,620
Okay so starting from index three.

300
00:23:52,650 --> 00:23:53,990
Give me the five characters.

301
00:23:54,120 --> 00:24:01,080
So it will give me that correctly present danger index three four five six and seven simple.

302
00:24:01,830 --> 00:24:07,040
And what you can also do so you can store that is thing and the string and you can bring the dead string.

303
00:24:07,050 --> 00:24:17,220
So let us store that the dessert in as Fife and you can print as 5.

304
00:24:17,270 --> 00:24:21,140
So basically this substring function it will not change the original string.

305
00:24:21,140 --> 00:24:21,960
Simple.

306
00:24:21,960 --> 00:24:23,210
So let's test

307
00:24:27,590 --> 00:24:28,430
okay so this is.

308
00:24:28,430 --> 00:24:28,960
And line

309
00:24:35,570 --> 00:24:40,300
so ABC the perfect okay.

310
00:24:40,300 --> 00:24:42,940
So what other functions do we have.

311
00:24:42,940 --> 00:24:45,370
So we have one more function.

312
00:24:45,370 --> 00:24:46,380
Find a function.

313
00:24:46,390 --> 00:24:49,420
So basically what you can do you will call the function find.

314
00:24:49,450 --> 00:24:58,500
So as for dot find and I want to find various ABC present I want to find a way it is ABC present in

315
00:24:58,860 --> 00:25:01,370
string as food.

316
00:25:01,590 --> 00:25:04,740
So how will find function works.

317
00:25:04,740 --> 00:25:16,340
So suppose this is your string let's say this is the E F ABC ABC and then again ABC and if I call the

318
00:25:16,340 --> 00:25:21,910
function as DART find ABC.

319
00:25:22,000 --> 00:25:26,290
So basically I want to find various ABC present and this a string.

320
00:25:26,290 --> 00:25:29,970
So ABC presented ABC President air ABC is presented.

321
00:25:29,980 --> 00:25:32,590
So this find function will return me in Deja.

322
00:25:32,710 --> 00:25:35,290
So this A.J. is actually the index.

323
00:25:35,290 --> 00:25:38,710
So at index of E various this ABC present.

324
00:25:39,130 --> 00:25:43,000
So this ABC is present at multiple locations so 0 1 2.

325
00:25:43,030 --> 00:25:44,460
So this is index 3.

326
00:25:44,500 --> 00:25:46,730
So ABC is present at index 3.

327
00:25:46,900 --> 00:25:49,840
So this is four five then six seven eight.

328
00:25:50,110 --> 00:25:52,990
And then this is 9 10 and 11.

329
00:25:52,990 --> 00:26:00,580
So this ABC string is presented Kleenex it is present at the next three it is president I didn't take

330
00:26:00,580 --> 00:26:09,860
six and it is present at the next nine so two times this is string ABC is present this fine function

331
00:26:09,860 --> 00:26:15,500
will have done me the first index the index at which it will find the ABC first.

332
00:26:15,620 --> 00:26:17,750
So the output will be three.

333
00:26:17,960 --> 00:26:25,800
Now if the string is let's say this is a B then E B then E C and then ABC.

334
00:26:25,890 --> 00:26:31,690
So if this is this thing and I call the function as dark find string ABC.

335
00:26:31,690 --> 00:26:32,830
So what will be my output.

336
00:26:32,830 --> 00:26:41,430
So where is ABC present so ABC is peasant head only so they index zero one two three four five and six.

337
00:26:41,540 --> 00:26:48,780
So it will have done me six correct and if there are multiple locations at which the string is present

338
00:26:48,840 --> 00:26:56,730
it will give me the index of the first location so I am calling the find function I want to find a V

339
00:26:56,730 --> 00:27:01,100
it is ABC present in string as food so it older than me n and Deja

340
00:27:05,220 --> 00:27:10,020
so ABC is present at index 3 so let's see.

341
00:27:10,020 --> 00:27:17,370
So this is the string as food you can see ABC so ABC is present at the next three so that's why the

342
00:27:17,370 --> 00:27:27,150
output is in next three but fact so what other functions do we have we have a function to string.

343
00:27:27,220 --> 00:27:35,080
So for example you have an integer e let's say it is 123 now you want to convert this integer into a

344
00:27:35,080 --> 00:27:37,830
string so what you can do.

345
00:27:37,870 --> 00:27:44,000
So let us create a new String String a six so we have a function to underscore string

346
00:27:47,860 --> 00:27:50,070
and we will give e as input.

347
00:27:50,350 --> 00:27:57,130
So it will have done meet the string it will convert to integer into string and let us print as six

348
00:28:04,790 --> 00:28:06,070
so this s six.

349
00:28:06,080 --> 00:28:13,420
This is s s six so when twenty three is now string 123 so I'm a rating myself.

350
00:28:13,700 --> 00:28:17,840
So this is one twenty three in Deja This is when going between digit.

351
00:28:18,020 --> 00:28:23,210
Now you are playing a function boosting and boosting function will take indeed as input.

352
00:28:23,330 --> 00:28:30,080
So this boosting function it will take I Indigenous input I am giving when going to three and it will

353
00:28:30,080 --> 00:28:31,720
convert the integer into listing.

354
00:28:31,730 --> 00:28:36,020
So this is now string 123 fine.

355
00:28:36,190 --> 00:28:41,090
So there's this thing one two or three you can change the values also because we can we can consider

356
00:28:41,140 --> 00:28:44,030
we can reap the strings as if it is entity.

357
00:28:44,070 --> 00:28:51,330
So when it does change the characters.

358
00:28:51,340 --> 00:28:58,580
So for example I want to change the first index the character represented the first and next let's say

359
00:28:58,580 --> 00:29:01,580
it is for now because it is a string.

360
00:29:01,580 --> 00:29:02,350
So you have to give.

361
00:29:02,350 --> 00:29:02,650
Correct.

362
00:29:02,660 --> 00:29:06,660
Therefore not indigent for so this is correct for now.

363
00:29:06,660 --> 00:29:09,060
And now let us also print as 6 again

364
00:29:18,450 --> 00:29:20,750
so when quantity was my original string.

365
00:29:20,760 --> 00:29:30,760
Now I change 2 in 2 4 so 2 is now converted into 4 so we have a function boosting similar.

366
00:29:30,760 --> 00:29:32,230
You also have a function you do.

367
00:29:32,980 --> 00:29:33,710
So.

368
00:29:35,480 --> 00:29:37,390
So I am using E again.

369
00:29:37,530 --> 00:29:38,550
So this e

370
00:29:41,540 --> 00:29:43,970
so this a is actually we have a function.

371
00:29:44,000 --> 00:29:44,420
You do.

372
00:29:44,420 --> 00:29:45,150
Oy.

373
00:29:45,270 --> 00:29:46,760
Now just do away function.

374
00:29:46,760 --> 00:29:50,750
It will take a string as input and it will return within Deja.

375
00:29:50,780 --> 00:29:52,940
So now let us sprint a

376
00:30:00,660 --> 00:30:00,880
okay.

377
00:30:00,890 --> 00:30:03,980
So I don't know in which library to a function is present.

378
00:30:04,790 --> 00:30:08,610
So what I'm going to do so instead of these three

379
00:30:24,110 --> 00:30:24,430
okay.

380
00:30:24,440 --> 00:30:26,390
This do function is not working

381
00:30:43,200 --> 00:30:43,470
okay.

382
00:30:43,480 --> 00:30:50,880
So for working of this into a function I think you have to write something like this a six note C and

383
00:30:50,890 --> 00:30:51,970
let's call SDR

384
00:30:59,320 --> 00:30:59,550
okay.

385
00:30:59,560 --> 00:31:01,750
So now it is working.

386
00:31:01,810 --> 00:31:03,060
So this is a function.

387
00:31:03,070 --> 00:31:11,440
What it does is it converts the given string into an integer so that you do a function it will take

388
00:31:11,520 --> 00:31:12,460
a integers input.

389
00:31:12,460 --> 00:31:13,150
So I am giving.

390
00:31:13,150 --> 00:31:14,680
It will take a string as input.

391
00:31:14,680 --> 00:31:16,100
So I'm giving a sixth.

392
00:31:16,360 --> 00:31:17,620
So I'm giving 1 4.

393
00:31:17,740 --> 00:31:24,490
So I'm giving when 43 and it will return me in digital 143 okay.

394
00:31:27,500 --> 00:31:34,790
Now let's say if you want to insert elements so you want to insert element and is six in a string so

395
00:31:34,790 --> 00:31:38,450
you can use push back function just like in vector.

396
00:31:38,450 --> 00:31:39,820
So I want to push back.

397
00:31:39,860 --> 00:31:48,080
Let's say I want to push back five so five will get pushed so let's run our program again.

398
00:31:53,250 --> 00:31:55,320
So 1 4 3 5.

399
00:31:55,800 --> 00:31:56,040
Okay.

400
00:31:56,040 --> 00:31:57,900
So let us also print a 6.

401
00:31:57,960 --> 00:32:02,750
Then we will print a so after pushing 5.

402
00:32:02,790 --> 00:32:17,810
Let us now print as 6.

403
00:32:18,020 --> 00:32:19,100
So what is happening here.

404
00:32:19,140 --> 00:32:28,680
So this was your 123 then twisting string function will convert 123 integer to 123 string then you are

405
00:32:28,680 --> 00:32:34,520
changing the first character to 40 so this will become 1 40 then you are pushing 5.

406
00:32:34,590 --> 00:32:38,690
So this will become 1 4 3 and 5.

407
00:32:38,910 --> 00:32:42,970
You add printing a 6 so 1 4 3 5 is getting printed here.

408
00:32:43,080 --> 00:32:45,030
Then you are using you to away function.

409
00:32:45,030 --> 00:32:47,970
So you do a function will convert it into integer.

410
00:32:48,000 --> 00:32:50,350
So this is 1 4 3 5 and then you add printing.

411
00:32:50,670 --> 00:32:53,630
So it is getting printed 1 4 3 5.

412
00:32:54,120 --> 00:32:56,370
So that is how everything is working.

413
00:32:56,520 --> 00:33:03,570
So we have also pushed back function just like in vector so you can see strings are much much powerful

414
00:33:03,630 --> 00:33:05,320
then the connectivity.

415
00:33:05,400 --> 00:33:06,960
Now how this things are working.

416
00:33:06,990 --> 00:33:10,810
So string I told you so string is actually a plus.

417
00:33:11,010 --> 00:33:18,530
So string is actually a class and in the implementation of this class basically it is using connectivity

418
00:33:19,410 --> 00:33:21,550
if you will see the implementation of the string class.

419
00:33:21,570 --> 00:33:30,310
Internally it is using character added only so I think I have covered many functions of the string.

420
00:33:32,050 --> 00:33:37,710
So if you have any doubt and you have these functions you can ask me I will share the code with you.

421
00:33:37,810 --> 00:33:39,380
So I will see you in the next one.

422
00:33:39,440 --> 00:33:39,820
Bye bye.
