Spicyztrickz

Loot Tricks, Free Recharge Tricks, Paytm, Mobile Offer 2019, Unlimited Paytm Cash, Highest Paying Latest Apps & Websites. Best Deals Of The Day.

Delete a Substring from text || C program


// Comment
#include
#include
int main()
{
 char text[100],sub[20],new_text[100];
 int i=0,j,k,temp=0,n=0;
 printf("[+]Enter the Text: ");
 gets(text);
 printf("\n [+]Enter Substring to be deleted : ");
 gets(sub);
 while(text[i]!='\0')
 {
  j=0,k=i;
  while(text[k]==sub[j] && sub[j]!='\0')
  {
   k++;
   j++;
  }
  if(sub[j]=='\0')
   temp=k;
  new_text[n]=text[temp];
  i++;
  temp++;
  n++;
 }
 new_text[n]='\0';
 printf("[+]\n The new string is : ");
 puts(new_text);
 return 0;
}
output
[+]Enter the Text: tutorial.spicyztrickz.com

 [+]Enter Substring to be deleted : tutorial.
[+]
 The new string is : spicyztrickz.com

Process returned 0 (0x0)   execution time : 40.160 s
Press any key to continue.

Labels:

Post a Comment

[disqus]

MKRdezign

{facebook#https://www.facebook.com/12brahma/} {twitter#https://twitter.com/brahmasanidipak} {google-plus#https://plus.google.com/118318150044608348295} {pinterest#https://in.pinterest.com/spicyztrickz/} {youtube#YOUR_SOCIAL_PROFILE_URL} {instagram#YOUR_SOCIAL_PROFILE_URL}

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget