首页 > 其他分享 >dart functionSet

dart functionSet

时间:2023-01-11 00:33:06浏览次数:42  
标签:index String int len dirNames functionSet path dart

文件

  1. 根据传入的路径,返回上N级目录
/// 0表示当前路径, -1 上一级路径 返回值的最后面有 /
/// 最多到达磁盘目录
String getPathFromIndex(String path, int index){
  List<String> dirNames = path.split("\\");
  dirNames.removeLast();
  print(dirNames);
  int len = dirNames.length;
  for(int i = 0;i < -index && i < len - 1;i++){
    dirNames.removeLast();
  }
  path = "";
  for(var dir in dirNames){
     path = "$path$dir/";
  }
  return path;
}

标签:index,String,int,len,dirNames,functionSet,path,dart
From: https://www.cnblogs.com/sqmw/p/17042616.html

相关文章

  • dart文件中的属性以及(class)类属性
    dart不像java只能在class里面定义属性,而属性为类属性或者对象属性dart在此之外还可以直接在dart文件里面定义属性如test.dart里面的代码inta=1;test.dart里面......
  • dart file and directory(目录或者文件操作)
    文件读写Filefile=File("XXX");file.exists();//在假设为文件的时候判定文件是否存在,如果是目录返回false目录Directorydirectory=Directory("XXX");direc......
  • win32 EnumWindows in dart
    使用和C里面完全一样latefinalint_workerWHexHandle;int_enumWindowsProc(inthWnd,intlParam){///print(hWnd.toRadixString(16));intpHWnd=FindWindo......
  • dart use DLL file
    Weneedtodotwostepsdefinetwotypesonefordartitselfandoneforffi,withffiasthebridgetypedefChangeBackgroundFFI=ffi.VoidFunction(ffi.Poin......
  • [C++/Java/Py/C#/Ruby/Swift/Go/Scala/Kotlin/Rust/PHP/TS/Elixir/Dart/Racket/Erlang
    目录题解地址代码cppjavapython3C#rubyswiftgolangscalakotlinrustphptypescriptelixirdartracketerlang题解地址https://leetcode.cn/problems/counting-words-with-a-g......
  • dart isolate
    isolate的理解isolate原型externalstaticFuture<Isolate>spawn<T>(voidentryPoint(Tmessage),Tmessage,{boolpaused=false,boolerrorsAreFa......
  • dart HttpSocket&HttpClient
    HttpSocketvarserver=awaitHttpServer.bind(InternetAddress.loopbackIPv4,4040,);print('Listeningonlocalhost:${server.port}');awaitfor(HttpReq......
  • Dart中不得不会的mixins
    文章目录​​一、mixins是什么?​​​​二、使用场景​​​​三、注意​​​​四、代码案例​​一、mixins是什么?在面向对象的编程语言中,mixin(或mix-in)是一个类,其中包含供其......
  • 【LeetCode2180】[Go/C++/C#/Ruby/Swift/Kotlin/Rust/PHP/TS/Racket/Dart/Java/Elixir
    [toc]题解地址https://leetcode.cn/problems/count-integers-with-even-digit-sum/solutions/2047123/by-yhm138_-w8co/lc2180代码//点击指定元素document.querySel......
  • dart Socket and ServerSocket
    ServerSocketvoidmain()async{ServerSocketserverSocket=awaitServerSocket.bind("localhost",8888);serverSocket.listen((Socketclient){client......