stripFilenameExtension static method

String stripFilenameExtension(
  1. String path
)

Strip filename extension

Implementation

static String stripFilenameExtension(String path) {
  final extIndex = path.lastIndexOf('.');
  if (extIndex == -1) return path;
  final folderIndex = path.lastIndexOf('/');
  if (folderIndex > extIndex) return path;
  return path.substring(0, extIndex);
}