1import{u as g,r as u,j as t,L as y}from"./index-j7I9Tmll.js";const h=/[\p{L}\p{M}\p{N}]+(?:['â.][\p{L}\p{M}\p{N}]+)*/gu,j=new Set(["a","an","the","and","but","or","nor","for","so","yet","as","at","by","in","of","off","on","per","to","up","via"]),x=/[.!?:;ââ\n]/,b=e=>{const[s="",...o]=Array.from(e);return s.toUpperCase()+o.join("").toLowerCase()},N=e=>e.length>1&&e===e.toUpperCase()&&e!==e.toLowerCase(),L=e=>e.toUpperCase(),S=e=>e.toLowerCase(),E=e=>e.replace(h,b);function A(e){const s=[...e.matchAll(h)],o=new RegExp("\\p{Ll}","u").test(e);let r="",n=0;return s.forEach((i,d)=>{const c=i[0],a=e.slice(n,i.index),l=s[d+1],m=l?e.slice(i.index+c.length,l.index):"",v=d===0||x.test(a),w=!l||x.test(m);let p;o&&N(c)?p=c:!v&&!w&&j.has(c.toLowerCase())?p=c.toLowerCase():p=b(c),r+=a+p,n=i.index+c.length}),r+e.slice(n)}function k(e){let s="",o=!0,r=!1;for(const n of e.toLowerCase()){if(/[\p{L}\p{N}]/u.test(n)){s+=o?n.toUpperCase():n,o=!1,r=!1;continue}n===` 2`?o=!0:".!?".includes(n)?r=!0:/\s/.test(n)&&r&&(o=!0),s+=n}return s.replace(new RegExp("(?<![\\p{L}\\p{N}'â])i(?=['â](?:m|ll|ve|d)(?![\\p{L}\\p{N}])|(?![\\p{L}\\p{N}'â]))","gu"),"I")}function R(e){return Array.from(e,s=>{const o=s.toLowerCase();return s===o?s.toUpperCase():o}).join("")}function C(e,s=1){const o=" ".repeat(s);return e.replace(/\r\n?/g,` 3`).split(/\n[ \t]*\n\s*/).map(r=>r.replace(/\s+/g," ").trim().replace(/ +([,.;:!?])/g,"$1").replace(/([.!?]["'ââ)\]]*) +/g,`$1${o}`).replace(new RegExp(`(?<=[\\p{Ll}\\p{N}])([.!?]["'ââ)\\]]*)(?=\\p{Lu})`,"gu"),`$1${o}`)).filter(Boolean).join(` 4 5`)}const T=[{id:"upper",label:"UPPER CASE",convert:L},{id:"lower",label:"lower case",convert:S},{id:"title",label:"Title Case",convert:A},{id:"sentence",label:"Sentence case",convert:k},{id:"capitalized",label:"Capitalized Case",convert:E},{id:"inverse",label:"iNVERSE cASE",convert:R},{id:"normalize-single",label:"Normalize (single space)",convert:e=>C(e,1)},{id:"normalize-double",label:"Normalize (double space)",convert:e=>C(e,2)}];function U(e){return{characters:Array.from(e).length,words:(e.match(h)||[]).length,lines:e?e.split(/\r\n?|\n/).length:0}}const z="Case Converter â Uppercase, Lowercase, Title & Sentence Case | Kernel Tools",f="Free online case converter. Change text to UPPER CASE, lower case, Title Case, Sentence case, Capitalized Case or iNVERSE cASE, and clean up extra spaces. Runs in your browser.",P=[["UPPER CASE","Every letter becomes a capital. Handy for headings, or text typed with caps lock off."],["lower case","Every letter becomes small, for fixing text typed with caps lock on."],["Title Case","Capitalizes each word but keeps short words such as a, the, and, of and to in lower case, unless they start or end the title or follow a colon. Acronyms like PDF or NASA stay in capitals."],["Sentence case","Makes everything lower case, then capitalizes the first letter of each sentence and each new line, and the word âIâ. Names and places are not detected, so capitalize those yourself."],["Capitalized Case","Capitalizes the first letter of every word, including short words like âofâ and âtheâ."],["iNVERSE cASE","Swaps each letter: capitals become small and small letters become capitals."],["Normalize (single or double space)","Cleans up spacing without changing letter case: removes extra spaces and tabs, removes spaces before commas and full stops, joins broken lines, and puts one or two spaces after each sentence. Blank lines between paragraphs are kept, and web addresses and decimals are left alone."]];function I(){g({title:z,description:f,keywords:["case converter","convert case","uppercase to lowercase","title case converter","sentence case converter"],structuredData:{"@context":"https://schema.org","@type":"WebApplication",name:"Case Converter",description:f,url:"https://kerneltools.dev/case-converter",applicationCategory:"UtilitiesApplication",operatingSystem:"Any",offers:{"@type":"Offer",price:"0",priceCurrency:"INR"}}});const[e,s]=u.useState(""),[o,r]=u.useState(""),n=U(e),i=a=>{s(a.convert(e)),r(`Converted to ${a.label}.`)},d=async()=>{try{await navigator.clipboard.writeText(e),r("Copied to clipboard.")}catch{r("Copy failed. Select the text and copy it manually.")}},c=()=>{const a=URL.createObjectURL(new Blob([e],{type:"text/plain;charset=utf-8"})),l=document.createElement("a");l.href=a,l.download="converted-text.txt",l.click(),setTimeout(()=>URL.revokeObjectURL(a),1e3)};return t.jsxs("div",{className:"case-page",children:[t.jsxs("header",{className:"case-heading",children:[t.jsx("span",{className:"case-eyebrow",children:"TEXT TOOLS"}),t.jsx("h1",{children:"Case converter"}),t.jsx("p",{children:"Paste your text, then pick a case. Your text is converted in your browser and never leaves your device."})]}),t.jsxs("section",{className:"case-workspace",children:[t.jsxs("div",{className:"writing-toolbar",children:[t.jsx("span",{children:"Aa / Writing desk"}),t.jsx("a",{href:"#case-guide",children:"Conversion guide â"})]}),t.jsx("label",{htmlFor:"case-input",children:"Your text"}
5),t.jsx("textarea",{id:"case-input",value:e,onChange:a=>{s(a.target.value),r("")},placeholder:"Paste or type text hereâ¦",spellCheck:"false"}),t.jsxs("p",{className:"case-stats",children:[n.characters.toLocaleString()," characters · ",n.words.toLocaleString()," words · ",n.lines.toLocaleString()," lines"]}),t.jsx("div",{className:"case-modes",role:"group","aria-label":"Convert to",children:T.map(a=>t.jsx("button",{className:"btn btn-ghost",onClick:()=>i(a),disabled:!e,children:a.label},a.id))}),t.jsxs("div",{className:"case-actions",children:[t.jsx("button",{className:"btn btn-primary",onClick:d,disabled:!e,children:"Copy text"}),t.jsx("button",{className:"btn btn-ghost",onClick:c,disabled:!e,children:"Download .txt"}),t.jsx("button",{className:"btn btn-ghost",onClick:()=>{s(""),r("")},disabled:!e,children:"Clear"})]}),t.jsx("p",{className:"case-notice",role:"status",children:o})]}),t.jsxs("section",{className:"case-info",id:"case-guide",children:[t.jsx("h2",{children:"How to use the case converter"}),t.jsxs("ol",{children:[t.jsx("li",{children:"Paste or type your text in the box."}),t.jsx("li",{children:"Choose a case. The text in the box is replaced with the converted version."}),t.jsx("li",{children:"Copy the result, or download it as a .txt file."})]}),t.jsx("h2",{children:"What each option does"}),t.jsx("dl",{children:P.map(([a,l])=>t.jsxs("div",{children:[t.jsx("dt",{children:a}),t.jsx("dd",{children:l})]},a))}),t.jsx("h2",{children:"Is my text uploaded?"}),t.jsx("p",{children:"No. The conversion runs in your browser tab. Your text is not sent to a server or stored, and this page loads no ads."}),t.jsx("h2",{children:"Related tools"}),t.jsxs("p",{children:["Need to encode text for a URL or an API? Try the ",t.jsx(y,{to:"/base64-tools",children:"Base64 tools"}),"."]})]})]})}export{I as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.