首页 > 其他分享 >无涯教程-Erlang - is_dir函数

无涯教程-Erlang - is_dir函数

时间:2023-12-06 10:32:44浏览次数:109  
标签:erlang 无涯 filelib start 目录名 Erlang 目录 dir

此方法用于确定目录是否确实是目录,此方法是filelib库的一部分。

is_dir - 语法

is_dir(directoryname)
  • directoryname  -  这是目录名,是否为目录名。

is_dir - 返回值

是的,如果目录存在并且确实是目录。

-module(helloLearnfk). 
-export([start/0]). 

start() -> 
   io:fwrite("~p~n",[filelib:is_dir("newdir")]).

如果目录存在,则输出为true。

参考链接

https://www.learnfk.com/erlang/erlang-is-dir.html

标签:erlang,无涯,filelib,start,目录名,Erlang,目录,dir
From: https://blog.51cto.com/u_14033984/8700274

相关文章

  • 无涯教程-Erlang - copy函数
    此方法用于复制现有文件。copy-语法copy(source,destination)source     - 需要复制的源文件的名称。destination -文件的目标路径和名称。copy-示例-module(helloworld).-export([start/0]).start()->file:copy("Newfile.txt","Duplicate.......
  • 无涯教程-Erlang - write函数
    此方法用于将内容写入文件。write-语法write(FileHandler,text)FileHandler-这是文件的句柄。该句柄是使用file:open操作时将返回的句柄。text        - 需要添加到文件中的文本。write-示例-module(helloLearnfk).-export([start/0]).sta......
  • 无涯教程-Erlang - file_read函数
    有一种方法可以允许一次读取文件的所有内容,这是通过file_read方法完成的。语法file_read(filename)参数filename-这是需要读取的文件名。返回值文件的全部内容。-module(helloLearnfk).-export([start/0]).start()->Txt=file:read_file("Newfile.txt"),i......
  • 无涯教程-Erlang - sort函数
    对元素列表进行排序。sort-语法sort(lst)Lst - 需要排序的元素列表。sort-返回值返回元素的排序列表。-module(helloLearnfk).-import(lists,[sort/1]).-export([start/0]).start()->Lst1=[5,6,4],io:fwrite("~p~n",[sort(Lst1)]).当我们运行......
  • 无涯教程-Erlang - reverse函数
    反转元素列表。reverse-语法reverse(lst)Lst  - 需要反转的元素列表。reverse-返回值返回元素的反向列表。-module(helloLearnfk).-import(lists,[reverse/1]).-export([start/0]).start()->Lst1=[1,2,3],io:fwrite("~p~n",[reverse(Lst1)]).......
  • 无涯教程-Erlang - merge函数
    返回通过合并ListOfLists的所有子列表形成的排序列表。merge-语法merge(ListsofLists)ListsofLists -需要合并的列表集合。merge-返回值返回元素的合并列表。-module(helloLearnfk).-import(lists,[merge/1]).-export([start/0]).start()->io:fwri......
  • 无涯教程-Erlang - last函数
    返回列表的最后一个元素。last-语法last(lst1)Lst1-元素列表。last-返回值返回列表的最后一个元素。-module(helloLearnfk).-import(lists,[last/1]).-export([start/0]).start()->Lst1=[1,2,3,4],io:fwrite("~w~n",[last(Lst1)]).当我们运行上述......
  • 无涯教程-Erlang - any函数
    如果List中的至少一个存在一个元素则返回true,则返回true。any-语法any(Pred,lst)Pred-将应用于字符串的断言函数Lst  -值列表any-返回值如果Pred(Elem)对List中的至少一个元素Elem返回true,则返回true。-module(helloLearnfk).-import(lists,[any/2]).-e......
  • 无涯教程-Erlang - left函数
    该方法根据字符数从字符串的左侧返回子字符串。left-语法left(str1,number)str1      - 这是需要从中提取子字符串的字符串。Number - 这是子字符串中需要出现的字符数。left-返回值根据字符串的左侧和数字返回原始字符串的子字符串。-module(he......
  • 无涯教程-Erlang - equal函数
    该方法返回一个布尔值,表明一个字符串是否等于另一个字符串。如果字符串相等,则将返回true值,否则将返回false值。equal-语法equal(str1,str2)str1,str2  - 需要比较的2个字符串。equal-返回值如果两个字符串相等,它将返回true值,否则将返回false值。-module(helloLear......