zoukankan      html  css  js  c++  java
  • HelpersDocument

    HelpersDocument

    The document class is a collection of useful methods for working with files.

    To get the extension of a file call the getExtension method and pass the file name, the extension will then be returned.

    Create an alias

    use HelpersDocument;
    Document::getExtension('customfile.zip'); //returns zip

    To remove the extension of a file call the removeExtension method and pass the file name, the extension will then be removed and returned.

    Document::removeExtension('customfile.zip'); //returns customfile

    To find out the size in a human readable way call the formatBytes method:

    Document::formatBytes('4562'); //returns 4.46 KB

    Using the getFileType a filename is passed and returned is the name of the group that extension belongs to if no matches that 'Other' is returned.

    These are the current groups:

    • $images = array('jpg', 'gif', 'png', 'bmp');
    • $docs = array('txt', 'rtf', 'doc', 'docx', 'pdf');
    • $apps = array('zip', 'rar', 'exe', 'html');
    • $video = array('mpg', 'wmv', 'avi', 'mp4');
    • $audio = array('wav', 'mp3');
    • $db = array('sql', 'csv', 'xls','xlsx');
    Document::getFileType('customfile.zip'); //returns Application
  • 相关阅读:
    Android中内容观察者的使用 ContentObserver类详解 (转)
    Spinner
    对话框
    ButtonBar 的使用
    EditText/RadioButton/CheckBox使用
    ListView
    PieChar,此代码参考网上
    ComboBox中使用事件
    ColorPicker
    Button
  • 原文地址:https://www.cnblogs.com/chunguang/p/5643179.html
Copyright © 2011-2022 走看看