# Can I use part of Processing source code in my code?

**URL:** <https://discourse.processing.org/t/can-i-use-part-of-processing-source-code-in-my-code/4423>\
**Category:** Project Guidance\
**Created:** [October 13, 2018, 11:34am UTC](https://discourse.processing.org/t/can-i-use-part-of-processing-source-code-in-my-code/4423 "2018-10-13T11:34:27Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [October 13, 2018, 5:19pm UTC](https://discourse.processing.org/t/can-i-use-part-of-processing-source-code-in-my-code/4423/13 "2018-10-13T17:19:15Z")

</div>

You don’t need **split()** for parsing paths! Just use methods from Java’s File class: 📂  
[Docs.Oracle.com/en/java/javase/11/docs/api/java.base/java/io/File.html](http://Docs.Oracle.com/en/java/javase/11/docs/api/java.base/java/io/File.html)

Along w/ some methods from class String: 🔤  
[Docs.Oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html](http://Docs.Oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html)

```java
final File f = sketchFile("img.bmp");
println(f);

final String folderpath = f.getParent();
println(folderpath);

final String file = f.getName();
println(file);

final int idx = file.indexOf('.');
final String filename = file.substring(0, idx);
println(filename);

final String ext = file.substring(idx);
println(ext);

exit();

```

---

_[View the full topic](https://discourse.processing.org/t/can-i-use-part-of-processing-source-code-in-my-code/4423)._
