Example: Get the base name

public static int main (string[] args) {
// Output: ``my-test.txt``
File file = File.new_for_path ("/foo/bar/baz/my-test.txt");
print ("%s\n", file.get_basename ());
return 0;
}

 valac --pkg gio-2.0 GLib.File.get_basename.vala

See:




2022 vala-language.org