1
00:00:00,920 --> 00:00:02,420
Hello, dear friend.

2
00:00:02,450 --> 00:00:05,450
So in this section, we're going to learn string functions.

3
00:00:07,000 --> 00:00:13,690
Now, Escuela Server provides various escarole string functions which allow us to alter the individual

4
00:00:13,690 --> 00:00:21,070
characters in a string, trim strings, replace strings, convert strings and so on and so forth.

5
00:00:21,460 --> 00:00:22,780
Lots of fun to be had.

6
00:00:24,870 --> 00:00:28,860
So the first function that we're going to learn is the Lenn function.

7
00:00:29,930 --> 00:00:33,260
And this function just returns the length of a string.

8
00:00:35,730 --> 00:00:37,560
So this function takes one parameter.

9
00:00:38,780 --> 00:00:40,910
Now, the parameter must be a string.

10
00:00:42,130 --> 00:00:45,750
So let's jump in SSME and make some examples.

11
00:00:46,880 --> 00:00:50,900
We'll find the length of text with a land function.

12
00:00:52,190 --> 00:00:59,360
It's a learned function except one parameter, and our string will be OK, Academi, 20-20.

13
00:01:00,470 --> 00:01:04,850
And this query will return 16 is the length of this string.

14
00:01:07,360 --> 00:01:10,420
So the next function is left function.

15
00:01:11,490 --> 00:01:17,190
The left function extracts a number of characters from a string starting from the left.

16
00:01:19,400 --> 00:01:26,210
So this function will take two parameters, and it uses its second parameter to decide how many characters

17
00:01:26,270 --> 00:01:28,130
it should return from the left.

18
00:01:30,060 --> 00:01:36,300
And we will use the string, OK, Academy 20/20 as the first parameter and the second parameter will

19
00:01:36,300 --> 00:01:37,470
be three.

20
00:01:40,490 --> 00:01:45,410
And then this query will return the first three characters from the left of the string.

21
00:01:46,630 --> 00:01:50,320
The letters, OK, should be listed, so let's execute it and see.

22
00:01:51,750 --> 00:01:52,830
And there you have it.

23
00:01:53,800 --> 00:01:56,680
Here, the letters have all been listed.

24
00:01:58,920 --> 00:02:06,750
Now, in order to get the academy keywords, the second parameter should be 11 because there are 11

25
00:02:06,750 --> 00:02:10,980
characters, because, of course, the spaces are also counted.

26
00:02:14,340 --> 00:02:15,300
Trim function.

27
00:02:16,710 --> 00:02:20,160
And in some cases, we may need to remove spaces from a string.

28
00:02:21,090 --> 00:02:27,560
For instance, bases can cause problems while comparing two strings, and before we start to compare,

29
00:02:27,570 --> 00:02:30,500
we've got to remove the spaces from the string, right.

30
00:02:31,460 --> 00:02:38,780
So the trem function removes leading and trailing spaces from a string and guess what, it takes a string

31
00:02:38,780 --> 00:02:39,530
as a parameter.

32
00:02:41,510 --> 00:02:47,900
So we're going to use the string, OK, academy as the string, and we will add some spaces to the end

33
00:02:47,900 --> 00:02:48,560
of the string.

34
00:02:49,670 --> 00:02:55,390
Then the trim function will remove the leading and trailing spaces from the string.

35
00:02:57,270 --> 00:02:58,770
So let's execute the query.

36
00:02:59,720 --> 00:03:01,160
And here is the result.

37
00:03:02,840 --> 00:03:05,300
All the spaces have been removed from the string.

38
00:03:07,640 --> 00:03:11,780
Now, there are two functions that we can use in order to remove spaces from a string.

39
00:03:13,670 --> 00:03:16,280
The first one is El Trem function.

40
00:03:17,930 --> 00:03:23,420
The EL function is used to remove the leading blanks from a string.

41
00:03:25,770 --> 00:03:29,190
Second function is the art trim function.

42
00:03:30,150 --> 00:03:33,870
The Archim function is used to remove the trailing blanks from a string.

43
00:03:36,030 --> 00:03:36,990
Lower function.

44
00:03:38,700 --> 00:03:44,340
Now, the lower function is used to convert the given expression or text into a lowercase.

45
00:03:45,270 --> 00:03:48,570
So this function accepts only a string parameter.

46
00:03:50,350 --> 00:03:55,420
The parameter of the lower function will be OK, Academi 2020 with capital letters.

47
00:04:00,730 --> 00:04:07,120
And if we execute the query, we will see that all the letters have been converted into lowercase.

48
00:04:10,070 --> 00:04:12,920
So life wouldn't be complete without the upper function.

49
00:04:14,110 --> 00:04:19,000
The upper function is used to convert the given expression or text into uppercase.

50
00:04:19,900 --> 00:04:23,410
And this function accepts only a string as a parameter.

51
00:04:27,530 --> 00:04:33,590
The perimeter of the upper function will be OK, Academy 2020, again in lower case.

52
00:04:35,510 --> 00:04:41,030
And then if we execute the query, we will see that all the letters have been converted into uppercase.

53
00:04:44,200 --> 00:04:49,120
All right, so let's retrieve the first name and last name from the person table.

54
00:04:54,710 --> 00:04:57,140
And here are the first names and the last names.

55
00:05:00,340 --> 00:05:05,710
Now, we may need to convert a text to uppercase while retrieving from a table.

56
00:05:07,030 --> 00:05:11,470
So let's convert both first name and last name into uppercase.

57
00:05:13,600 --> 00:05:17,710
And that way, we should use the other key word for each column.

58
00:05:18,950 --> 00:05:26,390
So if you just executed and great, so all the first names and last names have been converted into uppercase.

59
00:05:29,920 --> 00:05:31,300
The reverse function.

60
00:05:32,930 --> 00:05:38,120
So the reverse function is used to reverse a string and return the result of that.

61
00:05:39,170 --> 00:05:43,100
So this function accepts only one string as a parameter.

62
00:05:44,720 --> 00:05:48,020
So let's reverse the string, OK, Academy 20-20.

63
00:05:49,050 --> 00:05:52,580
We should specify that string as a parameter of the reverse function.

64
00:05:53,670 --> 00:05:55,450
And that's it.

65
00:05:55,770 --> 00:05:56,330
He's ready.

66
00:05:57,770 --> 00:06:02,540
So if we execute the query, we will see that this string has been reversed.

67
00:06:05,500 --> 00:06:09,190
Would you believe me if I told you that there's something called the replace function?

68
00:06:10,470 --> 00:06:17,460
The replace function is used to replace all occurrences of a substring within a string with a new substring.

69
00:06:18,970 --> 00:06:21,670
And this function accepts three parameters.

70
00:06:22,890 --> 00:06:29,160
So the first parameter is this string, the second parameter is a part of the string that we want to

71
00:06:29,160 --> 00:06:30,120
change.

72
00:06:31,550 --> 00:06:36,860
And the last parameter is a part of the string that we want to be the replacement string.

73
00:06:37,340 --> 00:06:38,360
So that's a new part.

74
00:06:40,200 --> 00:06:44,820
So in this example, the string will be OK, Academy 2020 as the first parameter.

75
00:06:45,780 --> 00:06:50,850
And the day 2020 is part of this string and it will be the second parameter.

76
00:06:51,850 --> 00:06:54,130
Now, this is the part that we're going to want to change.

77
00:06:55,470 --> 00:07:00,300
The date 2021 will be the third parameter with the replace function.

78
00:07:01,250 --> 00:07:09,220
And this value will be the replacement with in other words, this will replace the second parameter,

79
00:07:09,230 --> 00:07:09,530
right?

80
00:07:10,130 --> 00:07:13,780
So this is what our query looks like when it's ready to be executed.

81
00:07:14,330 --> 00:07:19,430
And then if we execute the query, we will see that the second parameter has been changed into the third

82
00:07:19,430 --> 00:07:19,940
parameter.

83
00:07:23,040 --> 00:07:24,480
Substring function.

84
00:07:26,490 --> 00:07:33,180
So the substring function is used to extract some characters from a string, so the substring function

85
00:07:33,180 --> 00:07:34,880
accepts three parameters.

86
00:07:35,280 --> 00:07:42,420
The first parameter is the string, the second parameter is the start position, and then the last parameter

87
00:07:42,420 --> 00:07:44,940
is the length of the characters to extract.

88
00:07:45,570 --> 00:07:47,370
And it must be a positive number.

89
00:07:49,990 --> 00:07:56,170
So we're going to use OK, Academy 2020 again as a as the first parameter string.

90
00:07:57,580 --> 00:08:03,910
And the start position will be five and then this will be the second parameter.

91
00:08:05,370 --> 00:08:12,660
So the length of the characters to extract will be 12, and then that makes that the third parameter

92
00:08:12,660 --> 00:08:14,160
of the substring function.

93
00:08:15,210 --> 00:08:22,230
So when we execute the query, it will return a string from five is a start position, and then after

94
00:08:22,230 --> 00:08:27,150
counting five characters from the beginning of the first parameter, the start point will then be at

95
00:08:27,150 --> 00:08:29,880
the beginning of the academy keyword.

96
00:08:30,880 --> 00:08:34,930
Then it will count 12 characters and return the string.

97
00:08:36,090 --> 00:08:39,420
And the length of the Academy 2020 is well.

98
00:08:40,520 --> 00:08:42,650
So Academy 2020 is returned.

99
00:08:43,460 --> 00:08:44,300
So what do you think of that?

100
00:08:45,270 --> 00:08:50,550
In this section, we've learned string functions, now the following section, we're going to learn

101
00:08:50,550 --> 00:08:51,930
the math functions.

102
00:08:52,870 --> 00:08:54,630
You think it's all been leading up to this?

103
00:08:54,660 --> 00:08:57,660
Well, you may be right, so we'll see you there.
