# Having problems with split for directories

**URL:** <https://discourse.processing.org/t/having-problems-with-split-for-directories/46799>\
**Category:** Coding Questions\
**Created:** [July 26, 2025, 4:54pm UTC](https://discourse.processing.org/t/having-problems-with-split-for-directories/46799 "2025-07-26T16:54:01Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [July 27, 2025, 10:57am UTC](https://discourse.processing.org/t/having-problems-with-split-for-directories/46799/15 "2025-07-27T10:57:10Z")

</div>

> [@Grumpy\_Mike](#):
>
> It seems like the problem is in setting the screen title. This function requires a string and not an array.

Hello,

My code runs with out errors on W10 and Processing 4.4.4 and can extract the file name (see array contents) but was not used to set the title.

A bit of work and this can be used to set the title.

My focus was on your approach with your last code example on my system.  
I see there are alternative solutions!

I may very well be the issues with the slashes which can be OS dependent:

- [Backslash vs Forward Slash: Key Differences in Grammar and File Paths – WP Maintenance](https://wpmaintenancemode.com/backslash-vs-forward-slash-key-differences-in-grammar-and-file-paths/)
- [JavaFX GIF Player Discussion](https://discourse.processing.org/t/javafx-gif-player-discussion/46547)

This is _working_ here:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/4/9/49a452a6694c0af68d4cbafbc8ec100bfd3a8c40.png)

```auto
String filename = directories[directories.length-1]; 
surface.setTitle(filename); // Sets title to the name of file

```

_Working_ means no errors and _sets title_ for example provided (with additional edits) on my Windows 10 and Processing 4.4.4 setup.

It may still need work!

Lots to read in this topic and I will likely explore this in depth later.

`:)`

---

_[View the full topic](https://discourse.processing.org/t/having-problems-with-split-for-directories/46799)._
