Skip to content

Commit

Permalink
Added String To Integer Calculator (#1321)
Browse files Browse the repository at this point in the history
  • Loading branch information
Saipradyumnagoud authored Jun 14, 2024
1 parent ea51e83 commit 68a4c7c
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Calculators/String-To-Integer-Calculator/README.md
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)
23 changes: 23 additions & 0 deletions Calculators/String-To-Integer-Calculator/index.html
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>
10 changes: 10 additions & 0 deletions Calculators/String-To-Integer-Calculator/script.js
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;
}
69 changes: 69 additions & 0 deletions Calculators/String-To-Integer-Calculator/style.css
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;
}
14 changes: 14 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3060,6 +3060,20 @@ <h3>Computes stress and strain using force, area, and length inputs.</h3>
</div>
</div>
</div>
<div class="box">
<div class="content">
<h2>String To Integer Calculator</h2>
<h3>Converts the provided string to integer or decimal value.</h3>
<div class="card-footer">
<a href="./Calculators/String-To-Integer-Calculator/index.html" target="_blank">
<button>Try Now</button>
</a>
<a href="https://github.com/Rakesh9100/CalcDiverse/tree/main/Calculators/String-To-Integer-Calculator" title="Source Code" target="_blank">
<img src="./assets/images/github.png" alt="Source Code"></img>
</a>
</div>
</div>
</div>
<div class="box">
<div class="content">
<h2>Sunrise Sunset Calculator</h2>
Expand Down

0 comments on commit 68a4c7c

Please sign in to comment.