From 83ece57d55d2b54a139c0aa367daf4b2ea2dd86e Mon Sep 17 00:00:00 2001 From: Sachin Mittal Date: Sat, 1 Jan 2022 15:16:54 +0530 Subject: [PATCH] Added Sentence Case and Capitalized Case btn --- src/components/TextForm.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/components/TextForm.js b/src/components/TextForm.js index 07549d6..c64dc83 100644 --- a/src/components/TextForm.js +++ b/src/components/TextForm.js @@ -13,6 +13,29 @@ export default function TextForm(props) { setText(newText) props.showAlert("Converted to lowercase!", "success"); } + + // Credits: Sachin Mittal + const handleSeClick = ()=>{ + var newText = text.toLowerCase(); + newText = newText[0].toUpperCase() + newText.slice(1); + setText(newText) + props.showAlert("Converted to Sentense case!", "success"); + } + + // Credits: Sachin Mittal + const handleCaClick = ()=>{ + var newText = text.toLowerCase(); + const arr = newText.split(" "); + + for( let i=0 ; i{ let newText = ''; @@ -49,6 +72,8 @@ export default function TextForm(props) { + +