String is an integral part of all programming languages. Any input in different languages is usually taken as a string. Then he was converted to a particular data type. To print anything, it is printed as a string. That is, if you do not go to the user’s programming, then it is converted to string anytime. In this article, various work related to strings has been discussed.
Set one strings variable data for another string
In the program, it is often necessary to define a string variable data and string for other string variables. There is a library function called strcpy for C-language in which prototype is described in stdio.h file. It has been declared as a header file in the header below.
prototype: char * strcpy (* dest, const char * src)
The string variable data that is copied here is for src and the variables that are copied will be sent to dest. For example:
char n1  = “rahimn karim”;
char n2  = “”;
strcpy (n2, n1);
In the above program, two string variables named “H1” and “H2″ have been declared, in which the first data is assigned and the second is empty. After using the string copy function, a string’s data has been copied to another string. If we look at this, we can see that H1 is written in the function H1, which will work according to the prototype format.
Total in a string
Find out the number of characters
One of the many functions of a string in a program is to find out the total number of characters in the string. This is a very common problem for people who contribute to programming. The real example of such problems is that when a word processor is opened in a word processor, such as Microsoft Word, it shows the total number of characters in the file below. Not only this, if the user selects a particular paragraph, then there are several characters in the selected paragraph. However, there are many ways to solve such problems. But the easiest way is shown here. There is a library function named c-z strlen. Its work is to find the total length of any string. The following is a small example of how it is used and how it can be used to calculate the total number of strings in the string.
char _address  = f141,142 love road, tejgaon ”
int length = strlen (_address);
First declares a string variable and an address is placed as a value. There are several characters in that string. The strlen () function has been used to calculate it. Remember that the strlen () function always takes a string as a parameter and always returns an integer value, this value is the total number of characters in that string. Therefore, an integer is declared to be the length of the total number of addresses in the above address, and the value of the strlen () function has been set as its value. Then the value of the length variable is the number of the total number of addresses. Thus, using the library function, the number of strings can be calculated by the total number of strings. But it has been said before, it is the easiest way. So counting in this way all the strings of the characters will be considered. That means if there are so many spaces in a string, then it will also be seen as a character. Now if the user wants that the space will not be counted, or only if the number of characters will be counted, then the number of characters will not be counted in this manner. That is why we have to find the number of characters in other ways. One of the ways in which, to see if there is a single character in between all the characters in a string, first it will be counted. Then he will be considered. A small example is given below.
char _address  = “141,142 love road, tejgaon”
int count = 0;
char c = ”;
for (int i = 0; i <strlen (_address); i ++)
c = _address [i];
if ((c> = 65 && c = = 90) || (c> = 97 && c <= 122))
Here the previous example addresses as strings have been used. But in the previous example all the characters are counted, but only non-A and A-z will be counted, and if there is no other character then it will not be considered as a character. First, an integer named Count has been declared to count the characters. Then a temporal character variable named C has been declared. Now all the characters in a for loop address are checked. Here the condition of the for loop is strlen (_address); That is, the number of characters in the address and the for loop will run as long as possible. Then every time the address string is taken in the middle of the C variable, it has been checked. The checking is done with the rhythm and the direct value is used as a condition. We know that its value is 65-90 and the A-z value is 97-122. So if the value of the letter C is in the condition of the condition then only the value of the count variable increases by 1. And the end variable for the count variable is the total number of characters. This is a custom condition to calculate the character. If the user wants to count all the numerical characters as a character, then the condition of the rhythm will be adjusted accordingly. Here the condition is checked with ASCII values.
If you want the user can check with the direct character. In that case, the condition must be written as: if ((c> = ‘a’ && c <= ‘z’) || (c> = ‘A’ && c = ‘Z’). Because the condition was conditioned in the first case, it could raise the question that what is meant by> = a Ges <= z. Actually, we know that all the characters are known by the program’s value, so if the user gives the direct character, There is no question of converting it directly with the direct values, but we have to keep in mind that the single quote (”) should be written in the characters, so if we observe that the above conditions are written in a single quote, but the ASCII value The quote has not been written in the same way because whatever code is written in the single quotation, it will be considered as a character, and double quotes He will be seen as if the format string. Common encoding method is 55 characters. That is, the value of their aski 0255. General characters are numerical digits of the letter in English. If you want the user to the Internet can view the aski values. However, if no other language is used except English language, then there is no general encoding. Then it is encoded in Unicode where the Ascari character 0-22.