Skip to content

File.Extension

property · File · cAlgo.API Since 5.7

DesktopCLICloud

Gets the extension part of the file name, including the leading dot '.' even if it is the entire file name, or an empty string if no extension is present.

Definition

string Extension {get;}
file.Extension: str

Returns string

Examples

protected override void OnStart()
{
    if (DataFile.Extension != ".csv")
        Print("Expected a CSV file but got {0}", DataFile.Extension);
}
if api.DataFile.Extension != ".csv":
    api.Print(f"Expected a CSV file but got {api.DataFile.Extension}")
{
  "Parameters": [
    {
      "Name": "DataFile",
      "DisplayName": "Data File",
      "Type": "File"
    }
  ]
}