Campi e metodi di file_path
Un campo è un dato semplice sul valore, letto con un punto e senza parentesi: $value.name. Un metodo richiede argomenti o esegue un'operazione, e si chiama con ->: $value->name(arguments), oppure passando il valore con la pipe: $value |> name(arguments).
Campi
| Campo | Tipo | Descrizione |
|---|---|---|
.extension | string | L'estensione dopo l'ultimo punto, senza il punto: pdf in ./reports/summary.pdf, oppure '' se non c'è. |
.folder | file_path | Il percorso della cartella in cui si trova: ./reports per ./reports/summary.pdf, e null per ./ stesso. |
.name | string | L'ultimo nome, estensione inclusa: summary.pdf in ./reports/summary.pdf. |
.segments | list | I nomi in ordine, come scritti: ['.', 'reports', 'summary.pdf'] per ./reports/summary.pdf. |
.stem | string | L'ultimo nome senza estensione: summary in ./reports/summary.pdf, summary.final in summary.final.pdf. |
Metodi da any
->convert(from?: 'json'|yaml|'csv'|'markdown'|'latex', to?: 'json'|yaml|'csv'|html|'markdown'|'latex', header?: bool, as?: type, headers?: list, indented?: bool)->from(type: 'json'|yaml|'csv'|'markdown'|'latex', header?: bool, as?: type)->is_a(type: word)->is_null()->or(fallback)->to(type: 'json'|yaml|'csv'|html|'markdown'|'latex', headers?: list, indented?: bool)->to_string()->type()
Metodi da string
->contains(text, ignore_case?: bool)->count()->ends_with(text, ignore_case?: bool)->escape()->index_of(text, ignore_case?: bool, last?: bool)->lower()->markdown_escape()->matches(pattern: regex)->pad(width: number, char?, start?: bool)->replace(old, new, ignore_case?: bool)->slice(start: number, end?: number)->split(separator?)->starts_with(text, ignore_case?: bool)->truncate(length: number, suffix?)->upper()->url_encode()