大小写转换器

这个大小写转换器可一键将文本在不同字母格式间转换。支持转换为大写、小写、标题格式、句子格式、驼峰式、帕斯卡式、蛇形命名法等。粘贴文本并选择所需格式,即时完成转换。

0 characters · 0 words

Frequently Asked Questions

如何将文本转换为大写?

要将文本转换为大写,选择或粘贴您的文本并应用"大写"转换。每个小写字母(a-z)都会被替换为对应的大写字母(A-Z)。在编程中,大多数语言提供内置方法,例如JavaScript中的toUpperCase()、Python中的upper()或PHP中的strtoupper()。数字、符号和标点在转换过程中保持不变。

什么是标题格式(Title Case)?

标题格式将每个主要单词的首字母大写,同时保留次要词(如"a"、"an"、"the"、"and"、"but"、"or"、"in"、"on"、"at")为小写,除非它们是第一个或最后一个单词。例如,"the lord of the rings"变为"The Lord of the Rings"。不同的写作规范(APA、Chicago、AP)对哪些单词需要大写有略微不同的规则,但基本原则相同。

驼峰式(camelCase)和帕斯卡式(PascalCase)有什么区别?

驼峰式中,第一个单词以小写字母开头,后续每个单词以大写字母开头(例如"myVariableName")。帕斯卡式(也称为大驼峰式)中,每个单词(包括第一个)都以大写字母开头(例如"MyVariableName")。驼峰式在JavaScript和Java中惯用于变量和函数名,而帕斯卡式用于类名和React组件名。

如何转换为句子格式(Sentence Case)?

句子格式只将句子第一个单词的首字母大写,以及专有名词。所有其他字母均为小写。例如,"THIS IS A SAMPLE SENTENCE"变为"This is a sample sentence"。自动化工具会将每个句末标点(句号、问号、感叹号)后的第一个字母大写,但通常无法自动检测专有名词。

什么是蛇形命名法(snake_case)?

蛇形命名法将单词之间的空格替换为下划线,并将所有字母转换为小写。例如,"Hello World Example"变为"hello_world_example"。它广泛用于Python的变量和函数名(PEP 8规范)、数据库列名和文件命名。一个变体称为全大写蛇形命名法(SCREAMING_SNAKE_CASE),使用全大写字母,通常用于许多编程语言中的常量。

何时应该使用哪种文本格式?

大写(UPPERCASE)用于缩略词、标题和强调。小写(lowercase)用于正文和URL。标题格式(Title Case)用于标题和书名。句子格式(Sentence Case)用于普通句子和UI标签。驼峰式(camelCase)是JavaScript/Java变量的标准。帕斯卡式(PascalCase)用于类名和React组件。蛇形命名法(snake_case)是Python和SQL的标准。短横线命名法(kebab-case)用于CSS类、URL和文件名。

如何在短横线命名法(kebab-case)和驼峰式(camelCase)之间转换?

将短横线命名法转换为驼峰式时,删除每个短横线并将其后的字母大写。例如,"my-variable-name"变为"myVariableName"。将驼峰式转换为短横线命名法时,在每个大写字母前插入短横线并将所有内容转换为小写。例如,"myVariableName"变为"my-variable-name"。这种转换在CSS属性名(短横线命名法)和JavaScript属性名(驼峰式)之间切换时很常见。

如何在Excel或Google Sheets中更改大小写?

在Excel中,使用UPPER(A1)转大写,LOWER(A1)转小写,PROPER(A1)转标题格式。Google Sheets提供相同的函数。对于句子格式,没有内置函数——使用=UPPER(LEFT(A1,1))&LOWER(MID(A1,2,LEN(A1)))。注意PROPER()将每个单词大写,而不仅仅是主要单词,因此它与APA或Chicago风格中使用的真正标题格式不同。

不同编程语言的命名规范是什么?

JavaScript/TypeScript对变量/函数使用驼峰式,对类/组件使用帕斯卡式。Python对变量/函数使用蛇形命名法,对类使用帕斯卡式(PEP 8)。CSS对类名和属性使用短横线命名法。Go对导出标识符使用帕斯卡式,对未导出标识符使用驼峰式。Ruby对变量/方法使用蛇形命名法,对类使用帕斯卡式。SQL通常对关键字使用全大写,对列名使用蛇形命名法。

不同写作规范的标题格式有什么区别?

APA风格将4个字母及以上的单词和所有主要单词大写。Chicago Manual of Style无论长度如何将所有主要单词大写。AP风格将4个字母及以上的单词大写,但短介词和连词保持小写。MLA风格将除冠词、短介词和并列连词以外的所有单词大写。主要区别在于哪些小词需要大写——"with"在AP中为小写,但在Chicago风格中大写。

Case Converter

What Is a Case Converter?

A Case Converter is a text transformation tool that instantly converts your text into various letter case formats. Whether you need to change text to uppercase, lowercase, title case, or programming-specific formats like camelCase and snake_case, this tool handles it all in real time as you type. All conversions are displayed simultaneously so you can quickly copy the format you need.

Supported Case Types

UPPERCASE

Converts all letters to capital letters. Example: "hello world" becomes "HELLO WORLD".

lowercase

Converts all letters to small letters. Example: "Hello World" becomes "hello world".

Title Case

Capitalizes the first letter of every word. Example: "hello world" becomes "Hello World".

Sentence case

Capitalizes only the first letter of each sentence. Example: "hello world. goodbye world" becomes "Hello world. Goodbye world".

camelCase

Removes spaces and capitalizes the first letter of each word except the first. Example: "hello world" becomes "helloWorld". Commonly used in JavaScript and Java variable naming.

PascalCase

Like camelCase but the first letter is also capitalized. Example: "hello world" becomes "HelloWorld". Used for class names in many programming languages.

snake_case

Replaces spaces with underscores and lowercases all letters. Example: "Hello World" becomes "hello_world". Popular in Python and Ruby.

kebab-case

Replaces spaces with hyphens and lowercases all letters. Example: "Hello World" becomes "hello-world". Used in URLs and CSS class names.

CONSTANT_CASE

Like snake_case but all uppercase. Example: "hello world" becomes "HELLO_WORLD". Used for constants in many programming languages.

dot.case

Replaces spaces with dots and lowercases all letters. Example: "Hello World" becomes "hello.world". Used in configuration keys and package names.

How to Use

  1. Type or paste your text into the input field
  2. All case conversions are displayed simultaneously in real time
  3. Click the copy button next to any result to copy it to your clipboard
  4. The character count and word count are shown above the input

Examples

Input: "the quick brown fox"

CaseResult
UPPERCASETHE QUICK BROWN FOX
lowercasethe quick brown fox
Title CaseThe Quick Brown Fox
camelCasetheQuickBrownFox
PascalCaseTheQuickBrownFox
snake_casethe_quick_brown_fox
kebab-casethe-quick-brown-fox
CONSTANT_CASETHE_QUICK_BROWN_FOX
dot.casethe.quick.brown.fox

Common Use Cases

  • Converting titles and headings to the correct case format
  • Transforming variable names between different programming conventions
  • Fixing text that was accidentally typed in the wrong case
  • Preparing text for URLs, file names, or database fields
  • Standardizing text formatting in documents and spreadsheets
  • Converting between naming conventions when switching programming languages

Case Conventions in Programming

LanguageVariablesClassesConstants
JavaScriptcamelCasePascalCaseCONSTANT_CASE
Pythonsnake_casePascalCaseCONSTANT_CASE
CSSkebab-case--
Rubysnake_casePascalCaseCONSTANT_CASE
GocamelCasePascalCasePascalCase

Case Conversion in Excel & Google Sheets

Case TypeFormulaExample Result
UPPERCASE=UPPER(A1)HELLO WORLD
lowercase=LOWER(A1)hello world
Title Case=PROPER(A1)Hello World
Sentence case=UPPER(LEFT(A1,1))&LOWER(MID(A1,2,LEN(A1)))Hello world
Toggle caseNo built-in formulaUse this tool instead

Note: Excel's PROPER() capitalizes every word, which differs from true Title Case that keeps minor words lowercase. For camelCase, snake_case, and kebab-case, there are no built-in spreadsheet formulas — use this online converter instead.

Tips

  • Use camelCase for JavaScript/TypeScript variables and PascalCase for React components
  • Use snake_case when working with Python, Ruby, or database column names
  • Use kebab-case for CSS classes, URLs, and HTML attributes
  • CONSTANT_CASE is standard for environment variables and constant values across most languages
  • dot.case is commonly used in Java package names and configuration file keys

Related Tools