📜  字符串转大写字母 dart - Swift 代码示例

📅  最后修改于: 2022-03-11 15:01:03.584000             🧑  作者: Mango

代码示例1
extension CapExtension on String {
  String get inCaps => '${this[0].toUpperCase()}${this.substring(1)}';
  String get allInCaps => this.toUpperCase();
  String get capitalizeFirstofEach => this.split(" ").map((str) => str.capitalize).join(" ");
}

final helloWorld = 'hello world'.inCaps; // 'Hello world'
final helloWorld = 'hello world'.allInCaps; // 'HELLO WORLD'
final helloWorld = 'hello world'.capitalizeFirstofEach; // 'Hello World'