Is there a simple way to convert MySQL data into Title Case?(有没有一种简单的方法可以将 MySQL 数据转换为 Title Case?)
问题描述
我有一个 MySQL 表,其中一列中的所有数据都以大写形式输入,但我需要转换为标题大小写,并识别类似于 大胆的火球标题案例脚本.
I have a MySQL table where all the data in one column was entered in UPPERCASE, but I need to convert in to Title Case, with recognition of "small words" akin to the Daring Fireball Title Case script.
我发现了这个优秀的解决方案 用于将字符串转换为小写,但 Title Case 函数似乎已被排除在我的 MySQL 版本之外.有没有一种优雅的方法来做到这一点?
I found this excellent solution for transforming strings to lowercase, but the Title Case function seems to have been left out of my version of MySQL. Is there an elegant way to do this?
推荐答案
哇!我根本不擅长 SQL;这是对我有用的方法:
Woo! I'm not handy with SQL at all; Here's the method that worked for me:
- 将表导出为 .sql 格式的文本文件.
- 在 Textmate(我已经手头上)中打开文件.
- 选择包含大写数据的行.
- 从文本"菜单中选择转换",然后选择到标题框".
查找并替换以下各项的每个实例:
- Export the table as a text file in .sql format.
- Open the file in Textmate (which I already had handy).
- Select the rows with UPPERCASE data.
- Choose "Convert" from the "Text" menu, and select "to Titlecase".
Find and replace each instance of:
INSERT INTO `Table` (`Col1`, `Col2`, `Etc`, ...) VALUES
使用正确的小写值.
我之前没有尝试使用 Textmate 的原因是我无法弄清楚如何在不破坏其他数据的情况下将单个列转换为 Title Case,但这种方法似乎有效.感谢您的指导和支持!
The reason I didn't try using Textmate before was that I couldn't figure out how to convert a single column to Title Case without ruining the other data, but this method seems to work. Thanks for your guidance and support!
这篇关于有没有一种简单的方法可以将 MySQL 数据转换为 Title Case?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:有没有一种简单的方法可以将 MySQL 数据转换为 Title Case?


- 更改自动增量起始编号? 2021-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- SQL 临时表问题 2022-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01