Text Case Converter
Convert text to camelCase, PascalCase, snake_case, kebab-case, and more.
เมื่อใดควรใช้แต่ละ case
ทำไม case ถึงสำคัญในการเขียนโปรแกรม
ภาษาการเขียนโปรแกรมส่วนใหญ่แยกตัวพิมพ์เล็กใหญ่ — myVariable และ MyVariable เป็น identifier ที่แตกต่างกันโดยสิ้นเชิง การปฏิบัติตามรูปแบบการตั้งชื่อของภาษาและ codebase ของคุณเป็นสิ่งสำคัญสำหรับความสม่ำเสมอและความอ่านง่าย เครื่องมือนี้ช่วยให้คุณจัดรูปแบบ string ใดๆ อย่างรวดเร็วให้ตรงกับรูปแบบใดก็ได้โดยไม่ต้องแก้ไขแบบ manual
นักพัฒนาใช้เครื่องมือนี้เมื่อเปลี่ยนชื่อตัวแปรจาก Python codebase (snake_case) ไปยังโปรเจกต์ JavaScript (camelCase) นักเขียน content ใช้ Title Case สำหรับหัวข้อบล็อกและ Sentence case สำหรับ body copy วิศวกรฐานข้อมูลใช้แปลงชื่อคอลัมน์จาก export แบบ mixed-case เป็น snake_case สำหรับ SQL นักออกแบบ API ใช้ kebab-case สำหรับ URL endpoint และ camelCase สำหรับชื่อ field ใน JSON
สำหรับ identifier โค้ด วาง variable name เต็มและตัวแปลงจัดการการตรวจจับหลายคำโดยอัตโนมัติด้วยการแยกที่ space, underscore และ hyphen สำหรับ title ให้ใช้ Title Case ก่อนแล้วพิมพ์เล็ก preposition (of, in, at, by, for) และ article (a, an, the) ที่ไม่ควรพิมพ์ใหญ่แบบ manual CONSTANT_CASE เหมาะที่สุดสำหรับ string ที่แปลงเป็น snake_case แล้วเพื่อให้วาง underscore ถูกต้อง
บัก case เกิดขึ้นบ่อยกว่าที่คิด ระบบไฟล์บน macOS ไม่แยกตัวพิมพ์เล็กใหญ่โดยค่าเริ่มต้น หมายความว่า MyComponent.tsx และ mycomponent.tsx เป็นไฟล์เดียวกัน แต่ Linux (และเซิร์ฟเวอร์ production ส่วนใหญ่) แยกตัวพิมพ์เล็กใหญ่ ทำให้เกิด 404 error เมื่อ deploy URL slug ควรเป็นตัวพิมพ์เล็กเสมอเพื่อหลีกเลี่ยงบทลงโทษ duplicate content ใน SEO ชื่อตัวแปรสภาพแวดล้อมแยกตัวพิมพ์เล็กใหญ่บน Unix API_KEY และ api_key เป็นตัวแปรที่ต่างกันโดยสิ้นเชิง
- camelCase: ตัวแปรและฟังก์ชัน JavaScript/TypeScript
- PascalCase: ชื่อ class, React component, TypeScript type
- snake_case: ตัวแปร Python, Ruby, ชื่อคอลัมน์ database
- kebab-case: ชื่อ CSS class, URL slug, HTML attribute
- CONSTANT_CASE: ตัวแปรสภาพแวดล้อม, ค่าคงที่ config
- dot.case: key ของ configuration, Java package
- Title Case: หัวเรื่อง, ชื่อหนังสือ, ชื่อผลิตภัณฑ์
- Sentence case: label ใน UI, คำอธิบาย, body text
คำถามที่พบบ่อย
- What is camelCase?
- camelCase starts with a lowercase letter and capitalizes the first letter of each subsequent word with no spaces or separators. Example: 'hello world' → 'helloWorld'. Used in JavaScript variables and function names.
- What is PascalCase?
- PascalCase (also called UpperCamelCase) capitalizes the first letter of every word including the first one. Example: 'hello world' → 'HelloWorld'. Used for class names in most languages.
- What is snake_case vs kebab-case?
- snake_case joins words with underscores: 'hello_world'. Used in Python variables, database columns, and file names. kebab-case joins words with hyphens: 'hello-world'. Used in CSS classes, HTML attributes, and URL slugs.
- What is CONSTANT_CASE?
- CONSTANT_CASE (also called SCREAMING_SNAKE_CASE) is all uppercase with underscores. Example: 'api key' → 'API_KEY'. Used for constants in most programming languages.
เครื่องมือที่เกี่ยวข้อง
- JSON Formatter, Validator & Repair Tool
Format, minify, validate, and repair JSON instantly in your browser. Sort keys alphabetically, auto-format on paste, download as file, escape/unescape strings — free, no sign-up, 100% client-side.
- ตัวสร้าง QR Code
สร้าง QR code สำหรับ URL ข้อความ Wi-Fi และอื่นๆ ดาวน์โหลดเป็น PNG
- ตัวสร้างรหัสผ่าน
สร้างรหัสผ่านสุ่มที่แข็งแกร่งด้วยความยาวและชุดอักขระที่กำหนดเอง
- Base64 เข้ารหัส / ถอดรหัส
เข้ารหัสข้อความเป็น Base64 หรือถอดรหัสกลับเป็นข้อความธรรมดา
- URL เข้ารหัส / ถอดรหัส
เข้ารหัสหรือถอดรหัส URL และ query strings ด้วย percent-encoding