Answers for "dart string to uppercase"

5

string to capital letter dart

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'
Posted by: Guest on August-30-2020
0

dart char is uppercase

import 'dart:io';

main() {
  print("Enter a string : ");
  var str = stdin.readLineSync();

  if (str[0].toUpperCase() == str[0]) {
    print("The first character is uppercase");
  } else {
    print("The first character is not uppercase");
  }
}
Posted by: Guest on January-04-2021

Code answers related to "Swift"

Browse Popular Code Answers by Language