Dears,
As a Begginer student for C++, I know something about it but Please do us a favor.
Students will be thankfull for you ... If you support us , with alll the C++ string Functions ... So Please do...
Dears,
As a Begginer student for C++, I know something about it but Please do us a favor.
Students will be thankfull for you ... If you support us , with alll the C++ string Functions ... So Please do...
C++
The best
I got this one as the strang Function....
Prototype: char *strerror(int errnum);
Header File: string.h
Explanation: Strerror returns a pointer to a string that contains the identification for an error-number. This is usually used with a function that returns an error number based on the result of an operation. It is a very bad idea to start modifying the string it returns.
//Example prints out error number 2 #include <iostream.h> #include <string.h> int main() { cout<<strerror(2); return 0; }
One more Please............?
C++
The best
Compar function:
strcomp()
Prototype: int strcmp (const char *string1, const char *string2);
Header File: string.h
Explanation: Tests the strings for equality. Returns a negative number if string1 is less than string2, returns zero if the two strings are equal, and returns a positive number is string1 is greater than string2
//Example reads in two strings (w/out spaces) and compares them for equality
#include <string.h>
#include <iostream.h>
int main()
{
char *str1=new char[20];
char *str2=new char[20];
cin>>str1;
cin>>str2;
if(!strcmp(str1, str2)
cout<<"Strings are equal!";
return 0;
}
/* one more Please......
*/
C++
The best
Please add some string magic functions
C++
The best
strcat()
Prototype: char *strcat(char *Destination, char *Source);
Header File: string.h
Explanation: This function will concatenate (add to the end) the string pointed to by source on to the string pointed to by Destination. Returns a pointer to the Destination string.
Example:
//Example concatenates two strings to output
//By asking the user for input
#include <string.h>
#include <iostream.h>
int main()
{
char *s1 = new char[30];
char *s2 = new char[30];
cout<<"Enter string one(without spaces): ";
cin>>s1;
cout<<"Enter string two(without spaces): ";
cin>>s2;
cout<<strcat(s1, s2);
return 0;
}
/*********** THIS IS NICE ONE **************/
C++
The best
memcmp()
Prototype: int memcmp(const void *buffer1, const void *buffer2, size_t count);
Header File: string.h
Explanation: Alphabetically compares two arrays passed in to it. The fact that it is a void * simply means that it can have non-character arrays passed in to it. It is also necessary to pass how far to compare (ie, the size of the arrays) The return value is:
Less than zero buffer1 is less than buffer2
Zero buffer1 is equal to buffer2
Greater than zero buffer1 is greater than buffer2
Example:
//Program compares two character arrays
//Program compares only to eight letters
#include <stdlib.h>
#include <iostream.h>
int main()
{
int comp_val=memcmp("Andersronc", "Zandimva", 8);
if(comp_val==0)
cout<<"strings are equal";
if(comp_val<0)
cout<<"String one is alphabetically equal";
else
cout<<"String one is alphabetically greater";
return 0;
}
C++
The best
Anyone know what this thread is all about?
strcpy()
Prototype: char *strcpy(char *dest, char *tocopy);
Header File: string.h
Explanation: Strcpy will copy the string pointed to by tocopy into the string pointed to by dest.
//Example copies a string and outputs the copied string
#include <iostream.h>
#include <string.h>
int main()
{
char *a_string=new char[20];
strcpy(a_string, "Hello, world...");
cout<<a_string;
return 0;
}
C++
The best
Here is a full pacage.......
<string.h>
#define NULL <either 0, 0L, or (void *)0> [0 in C++]
void *memchr(const void *s, int c, size_t n); [not in C++]
const void *memchr(const void *s, int c, size_t n); [C++ only]
void *memchr(void *s, int c, size_t n); [C++ only]
int memcmp(const void *s1, const void *s2, size_t n);
void *memcpy(void *s1, const void *s2, size_t n);
void *memmove(void *s1, const void *s2, size_t n);
void *memset(void *s, int c, size_t n);
typedef ui-type size_t;
char *strcat(char *s1, const char *s2);
char *strchr(const char *s, int c); [not in C++]
const char *strchr(const char *s, int c); [C++ only]
char *strchr(char *s, int c); [C++ only]
int strcmp(const char *s1, const char *s2);
int strcoll(const char *s1, const char *s2);
char *strcpy(char *s1, const char *s2);
size_t strcspn(const char *s1, const char *s2);
char *strerror(int errcode);
size_t strlen(const char *s);
char *strncat(char *s1, const char *s2, size_t n);
int strncmp(const char *s1, const char *s2, size_t n);
char *strncpy(char *s1, const char *s2, size_t n);
char *strpbrk(const char *s1, const char *s2); [not in C++]
const char *strpbrk(const char *s1, const char *s2); [C++ only]
char *strpbrk(char *s1, const char *s2); [C++ only]
char *strrchr(const char *s, int c); [not in C++]
const char *strrchr(const char *s, int c); [C++ only]
char *strrchr(char *s, int c); [C++ only]
size_t strspn(const char *s1, const char *s2);
char *strstr(const char *s1, const char *s2); [not in C++]
const char *strstr(const char *s1, const char *s2); [C++ only]
char *strstr(char *s1, const char *s2); [C++ only]
char *strtok(char *s1, const char *s2);
size_t strxfrm(char *s1, const char *s2, size_t n);
Please ... if you are familure with any of them ...
can you write something about it Please....
C++
The best
This Theard about Strings function in C++...
As a beginner programmers in C++, we need to know something about String functions... So
I did ask you to send me some String functions... in the time that I was looking for these function too....
So I found alot of funcitons, which I could andersand some of it ... but I will need to understand more about it ....
is that answer your Question ???
C++
The best
Here's a good thread about strspn() and strcspn().
http://www.cprogramming.com/cboard/s...hlight=strcspn
My best code is written with the delete key.
Please if you can help me collecting them all in this thread ....
C++
The best
that is ridiculous. Please do not clutter the board with trash. Go to the GNU C documentation at http://www.aquaphoenix.com/ref/gnu_c_library/
>Please if you can help me collecting them all in this thread ....
I gave you them all, so stop bumping this lame thread.
-Prelude
My best code is written with the delete key.