-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathremove_csharp_comments.html
62 lines (58 loc) · 1.77 KB
/
remove_csharp_comments.html
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!DOCTYPE html>
<html>
<head>
<title>Remove Comments from C# Code</title>
<style>
body {
font-family: Arial, sans-serif;
}
.container {
max-width: 800px;
margin: 0 auto;
}
.form-group {
margin-bottom: 20px;
}
textarea {
width: 100%;
height: 200px;
}
button {
padding: 10px 20px;
background-color: #4CAF50;
border: none;
color: white;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
</style>
</head>
<body>
<div class="container">
<h1>Remove Comments from C# Code</h1>
<div class="form-group">
<label for="input-code">Paste your C# code here:</label>
<textarea id="input-code"></textarea>
</div>
<div class="form-group">
<label for="output-code">Your C# code without comments:</label>
<textarea id="output-code" readonly></textarea>
</div>
<button id="remove-comments">Remove Comments</button>
</div>
<script>
document.getElementById('remove-comments').addEventListener('click', function() {
var inputCode = document.getElementById('input-code').value;
// Remove single line comments
var withoutSingleLineComments = inputCode.replace(/\/\/.*/g, '');
// Remove block comments
var withoutComments = withoutSingleLineComments.replace(/\/\*[\s\S]*?\*\//g, '');
document.getElementById('output-code').value = withoutComments;
});
</script>
</body>
</html>