1 00:00:13,560 --> 00:00:16,980 Hello and welcome to the Golang programming language course. 2 00:00:17,430 --> 00:00:23,490 In the previous session, we talked about fields function in this string, and in this session we want 3 00:00:23,490 --> 00:00:26,190 to talk about the other extinct concept. 4 00:00:29,860 --> 00:00:39,670 Go blank, replace function, the replace function, replace some characters with some other characters 5 00:00:39,670 --> 00:00:40,480 in history. 6 00:00:42,740 --> 00:00:44,960 Now you can see the scene techs. 7 00:00:47,530 --> 00:00:55,990 In a specified number of characters that you want to replace in history, if any, is less than zero. 8 00:00:56,110 --> 00:00:59,260 There is no limit on the number of replacements. 9 00:01:00,220 --> 00:01:04,300 The function will replace all non-overlapping instances. 10 00:01:04,300 --> 00:01:13,220 Of all the new in a string, yes, is if old is empty, then it inserts new between it. 11 00:01:13,300 --> 00:01:22,600 Each valid UTF eight sequence of bias in their string is and if an is negative, then all instances 12 00:01:22,600 --> 00:01:24,820 of old will be replaced with new. 13 00:01:26,620 --> 00:01:31,000 Let's go to a school program to illustrate how to use replace function. 14 00:01:32,910 --> 00:01:39,930 First, create a string variable and assign the replace function to it for the example defined resolved 15 00:01:40,670 --> 00:01:42,600 call column equals. 16 00:01:43,230 --> 00:01:49,530 The strings package don't replace function 17 00:01:52,020 --> 00:01:53,470 for first argument. 18 00:01:53,490 --> 00:01:56,240 We set a string value, for the example. 19 00:01:57,560 --> 00:02:10,460 A B C D, that's a b c d, then select part of the created string as old arguments like a B and then 20 00:02:10,460 --> 00:02:19,310 define the string that is to replace the selected string as new like asterisk asterisk. 21 00:02:21,200 --> 00:02:28,910 And then a specified number of characters that you want to replace in history as an argument like one. 22 00:02:30,220 --> 00:02:40,960 Now, display, the result may either be resolved by labor and right another sample like the previous 23 00:02:40,960 --> 00:02:45,940 sample, except that we changed the value of end to minus one. 24 00:02:46,750 --> 00:02:52,800 So we see resolved equals history strings. 25 00:02:54,800 --> 00:02:56,090 Thoughts three place 26 00:02:59,480 --> 00:03:03,170 a b, c, d, d, d, b, c, d, 27 00:03:06,050 --> 00:03:16,220 a b minus three asterisk and sit in argument by minus one value. 28 00:03:17,060 --> 00:03:19,190 And again, this a result. 29 00:03:23,360 --> 00:03:23,740 OK. 30 00:03:23,830 --> 00:03:27,310 Reformative called Save the Project, then execute the program. 31 00:03:28,970 --> 00:03:37,820 Now we can see the output in the first sample because the value of N is one, the value of the asterisk 32 00:03:37,820 --> 00:03:45,830 changed by only one value of a b, but in the second sample, because the value of N has changed below 33 00:03:45,830 --> 00:03:46,460 zero. 34 00:03:46,730 --> 00:03:51,140 Any number of abs will be replaced by asterisk. 35 00:03:51,500 --> 00:03:51,920 OK. 36 00:03:52,070 --> 00:03:58,100 In order not to prolong the time of decision, we will finish it and we will continue the content in 37 00:03:58,100 --> 00:03:59,400 the next session. 38 00:03:59,450 --> 00:03:59,980 Goodbye.