-
Notifications
You must be signed in to change notification settings - Fork 386
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added String To Integer Calculator (#1321)
- Loading branch information
1 parent
ea51e83
commit 68a4c7c
Showing
5 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# <p align="center">String To Integer Calculator</p> | ||
|
||
## Description :- | ||
|
||
This project is a simple web-based calculator that converts strings to integers or decimal numbers. | ||
|
||
## Tech Stacks :- | ||
|
||
- HTML | ||
- CSS | ||
- JavaScript | ||
|
||
## Screenshots :- | ||
|
||
![image](https://github.com/Rakesh9100/CalcDiverse/assets/73993775/1fa44041-31b9-419d-9653-756b7e7d83ea) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link rel="stylesheet" href="style.css"> | ||
<title>String To Integer Calculator</title> | ||
</head> | ||
|
||
<body> | ||
<div class="converter"> | ||
<h2>String To Integer Calculator</h2> | ||
<textarea id="inputString" placeholder="Enter your string here..."></textarea> | ||
<br> | ||
<button onclick="convertString()">Convert</button> | ||
<div id="result"></div> | ||
</div> | ||
|
||
<script src="script.js"></script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
function convertString() { | ||
// Get the input string from the textarea | ||
var inputString = document.getElementById('inputString').value; | ||
|
||
// Convert each character to its ASCII value and join with spaces | ||
var asciiValues = Array.from(inputString).map(char => char.charCodeAt(0)).join(' '); | ||
|
||
// Display the result in the result div | ||
document.getElementById('result').textContent = asciiValues; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
body { | ||
font-family: Arial, sans-serif; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; | ||
background-color: skyblue; | ||
margin: 0; | ||
} | ||
|
||
.converter { | ||
background: #fff; | ||
padding: 20px; | ||
border-radius: 8px; | ||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); | ||
text-align: center; | ||
width: 400px; | ||
} | ||
|
||
.converter h2 { | ||
margin-bottom: 20px; | ||
color: #333; | ||
} | ||
|
||
.converter textarea { | ||
width: 100%; | ||
height: 100px; | ||
padding: 10px; | ||
margin-bottom: 10px; | ||
font-size: 16px; | ||
border: 1px solid #ccc; | ||
border-radius: 4px; | ||
box-sizing: border-box; | ||
transition: border-color 0.3s; | ||
} | ||
|
||
.converter textarea:focus { | ||
outline: none; | ||
border-color: #5264AE; | ||
} | ||
|
||
.converter button { | ||
display: inline-block; | ||
padding: 15px 30px; | ||
border: 2px solid #fefefe; | ||
text-transform: uppercase; | ||
color: #fefefe; | ||
background-color: #212121; | ||
text-decoration: none; | ||
font-weight: 600; | ||
font-size: 18px; | ||
border: none; | ||
cursor: pointer; | ||
border-radius: 4px; | ||
transition: background-color 0.3s, transform 0.2s; | ||
} | ||
|
||
.converter button:hover { | ||
background-color: #5264AE; | ||
transform: translateY(-2px); | ||
} | ||
|
||
#result { | ||
margin-top: 20px; | ||
font-size: 1.2em; | ||
color: #333; | ||
white-space: pre-wrap; | ||
text-align: left; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters