Senin, 26 November 2012

Function in the string operation

Function in the string  operation
What is string operation?
Operation string is as stdio operation  
Usually we use #include <stdio.h> and in this topic is #include <string.h>
String have some  function:
Function
Remarks
strlen()
to count of string
strcpy()
to copy string
strcmp()
to compare between to variable
strcspn()
to find the first part from other variable
strupr()
to change string to uppercase
strlwr()
to change string to lowercase


Example
========================
#include <string.h>
Char Nama[100], nama2[100];
Int A;
Nama = “Lukman mencoba MENJADI yang terbaik”;
A = Strlen(Nama); so the result is A = 35
                Why the result is 35? Please count of the letter
Nama2 = strupr(nama);
                The result is nama2 = “LUKMAN MENCOBA MENJADI YANG TERBAIK”

For other function you can try by your self .
I hope this article useful

Tidak ada komentar:

Posting Komentar