使用split方法解析路径

2076次阅读  |  发布于5年以前

使用split方法解析路径

Use the split() function in the path Pub package to split a path into its components.

import 'package:path/path.dart' as path;

main() {
  print(path.split('/Users/shailen')); // Prints ['/', 'Users', 'shailen'].

  // Windows example.
  print(path
      .split(r'C:\tempdir\tmp.txt')); // Prints [r'C:\', 'tempdir', 'tmp.txt'])
}

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8