A custom function implementation of string processing function

Source: Internet
Author: User

strlen function Stringlength.

int Stringlength (char *a)

{

int length=0;

while (a[length]!= ') {

length++;

}

return length;

}

Strcpyde with function function stringcopy.

void Stringcopy (char *a,char *b)

{

int length=0;

while (b[length]!= ') {

A[length] = B[length];

length++;

}

a[length]= ' + ';

}

Write functions that implement STRCAT functions Stringcatch

void Stringcatch (char *a,char *b,int c)

{

int length_b=0;

while (b[length_b]!= ') {

A[c+length_b]=b[length_b];

length_b++;

}

a[length_b+c]= ' + ';

}

Write a function stringcompare that implements STRCMP functionality.

int Stringcompare (char *a,char *b,int c,int D)

{

int length=0;

while (A[length]==b[length]) {

length++;

}

while ((*a-*b! = 0) && (length<=c| | Length<=d)) {

return a[length]-b[length];

}

return 0;

}

Write a function stringcompare that implements STRCMP functionality.

int Scompare (char String1[],char string2[]) {

int i=0;

while ((string1[i]!= ') && (string2[i]!= ')) {

if (string1[i]-string2[i]==0) {

i++;

}else{

Return (String1[i]-string2[i]);

}

}

Return (String1[i]-string2[i]);

}

A custom function implementation of string processing function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.