-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathhtml_code_parser.c
More file actions
47 lines (42 loc) · 888 Bytes
/
html_code_parser.c
File metadata and controls
47 lines (42 loc) · 888 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include<stdio.h>
#include<string.h>
void parse(char *string){
int inside=0,index=0;
for (int i = 0; i < strlen(string); i++)
{
if(string[i] == '<')
{
inside = 1;
continue;
}
else if(string[i] == '>')
{
inside = 0;
continue;
}
if(inside == 0)
{
string[index] = string[i];
index++;
}
}
string[index] = '\0';
while(string[0] == ' ')
{
for (int i = 0; i < strlen(string); i++)
{
string[i] = string[i+1];
}
}
while(string[strlen(string) - 1] == ' '){
string[strlen(string) - 1] = '\0';
}
}
int main(){
char string[100];
printf("Enter the HTML CODE : ");
gets(string);
parse(string);
printf("My string : %s ",string);
return 0;
}