大小写转换器
立即在多种字母大小写之间转换文本——全大写、全小写、标题格式、句首大写、camelCase、snake_case 等。一键复制任意结果。
使用方法
大小写转换是指在不改变底层内容的前提下,用不同的大写规则和单词连接方式重写同一段文字。同一个短语只需改变字母的大小写方式和单词的分隔方式,就能适配十几种不同场景——标题、变量名、电子表格列,或是 URL 短链接。这个工具会一次性把您输入的内容转换成十种常见格式,方便您复制最适合的那一种。
以句子“the quick brown fox jumps.”为例。转换为 UPPERCASE 后变成 THE QUICK BROWN FOX JUMPS,转换为 lowercase 后保持为 the quick brown fox jumps。Title Case 会将每个单词首字母大写——The Quick Brown Fox Jumps——而 Sentence case 只将第一个字母大写:The quick brown fox jumps。编程用的格式则完全去掉空格:camelCase 生成 theQuickBrownFoxJumps(第一个单词小写,后续每个单词首字母大写),PascalCase 生成 TheQuickBrownFoxJumps(每个单词首字母都大写),snake_case 生成 the_quick_brown_fox_jumps,kebab-case 生成 the-quick-brown-fox-jumps,CONSTANT_CASE 生成 THE_QUICK_BROWN_FOX_JUMPS。aLtErNaTiNg 格式则不考虑单词边界,逐字母交替大小写:tHe QuIcK bRoWn FoX juMpS。
每种格式往往都对应一个特定的使用场景。作家和编辑在标题和书名中偏爱 Title Case,在正文和图注中使用 Sentence case。程序员在 JavaScript 变量和函数名中使用 camelCase,在类和组件名中使用 PascalCase,在 Python 变量以及数据库或 CSV 列标题中使用 snake_case。kebab-case 则大量出现在 URL 短链接、CSS 类名和命令行参数中。CONSTANT_CASE 用来标记运行时不应更改的配置值和环境变量,让它们在源代码中一眼就能被识别出来。
为了正确拆分单词,转换器会识别空格、标点符号以及已有的 camelCase 边界——因此粘贴 theQuickBrownFox 时仍会被拆分为四个单词,而不是当作一个整体处理。转换过程绝不会改变您的原始输入;它只会改变每个结果框中显示的副本,让您可以尝试每一种格式,并复制所需的那一种,而无需重新输入任何内容。
示例
- Black (#000) on white (#fff) gives the maximum 21:1 ratio.
- #767676 grey on white is exactly 4.5:1 — the AA minimum for body text.
- Large headings only need 3:1 to pass AA.
常见问题
- What contrast ratio do I need?
- WCAG AA needs 4.5:1 for normal text and 3:1 for large text. AAA needs 7:1 and 4.5:1. AA is the common legal and design baseline.
- What counts as large text?
- Roughly 18.66px and bold, or 24px and up regardless of weight. Large text has a lower contrast requirement because it is easier to read.
- How is the ratio calculated?
- From each colour's relative luminance: (lighter + 0.05) ÷ (darker + 0.05). Luminance weights red, green and blue by how the eye perceives them.
- Does it check colour blindness?
- Contrast ratio helps everyone including many colour-blind users, but it does not replace testing that information is not conveyed by colour alone.