Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Request: Tokenize Strings (Arrays) (Read 1546 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Request: Tokenize Strings (Arrays)

Hello.

I'd like to request that Title Formating let's you tokenize text.

I use $directory for this, but it's not optimal. It divides strings by slashes (\ /), pipes (|), and colons (. Referencing the folders has to done from right to left, so I can't ask to use the first "folder" from the left.

Request: Tokenize Strings (Arrays)

Reply #1
In the meantime (or perhaps for infinity  ) you can use this:
Code: [Select]
$directory($replace(%path%,:,),$sub($sub($len(%path%),$len($replace(%path%,\,))),1))

The numeral denotes which directory level to return counting down from the topmost directory (excluding the drive).

Request: Tokenize Strings (Arrays)

Reply #2
In the meantime (or perhaps for infinity  ) you can use this

Thanks, that's good!
Still hope they would add this. I'm sure it wouldn't be hard for them.

$directory should accept negative values.

Request: Tokenize Strings (Arrays)

Reply #3
As a matter of curiosity and reference for others, here is the convoluted method for formatting the string for "directory path" . . . .

If we have this directory path string:
Quote
[font= "Lucida Console"]E:\Audio\V -- RaverMeister (label) collection\Vol.1 (1995)[/font]

We can simply display the string using this title formatting syntax:
Quote
[font= "Lucida Console"]$directory(%path%)[/font]

Or we can display it using this convoluted syntax:
Quote
----- separated lines for easy reading -----

[font= "Lucida Console"]$left(%path%,2)
['\'$directory($replace(%path%,:,),$sub($sub($len(%path%),$len($replace(%path%,\,))),1))]
['\'$directory($replace(%path%,:,),$sub($sub($len(%path%),$len($replace(%path%,\,))),2))]
['\'$directory($replace(%path%,:,),$sub($sub($len(%path%),$len($replace(%path%,\,))),3))]
['\'$directory($replace(%path%,:,),$sub($sub($len(%path%),$len($replace(%path%,\,))),4))]
['\'$directory($replace(%path%,:,),$sub($sub($len(%path%),$len($replace(%path%,\,))),5))]
[/font]

----- joined lines for using in foobar2000-----

[font= "Lucida Console"]$left(%path%,2)['\'$directory($replace(%path%,:,),$sub($sub($len(%path%),$len($replace(%path%,\,))),1))]['\'$directory($replace(%path%,:,),$sub($sub($len(%path%),$len($replace(%path%,\,))),2))]['\'$directory($replace(%path%,:,),$sub($sub($len(%path%),$len($replace(%path%,\,))),3))]['\'$directory($replace(%path%,:,),$sub($sub($len(%path%),$len($replace(%path%,\,))),4))]['\'$directory($replace(%path%,:,),$sub($sub($len(%path%),$len($replace(%path%,\,))),5))][/font]


Theoretically, if foobar2000 DUI allowed usage of "$RGB" coloring syntax everywhere, then the convoluted syntax actually could be used in a practical way.
You could conditionally color folder names, improving visual feedback when looking at masses of text.
Unfortunately, as of this posting date, the only Playlist/Library Rendering Component allowing you to do this in DUI is "foo_uie_esplaylist".

Request: Tokenize Strings (Arrays)

Reply #4
^ Replying to myself; sorry, I made a mistake . . . .

$directory(%path%) will output ...............:  Vol.1 (1995)

$directory_path(%path%) will output .......:  E:\Audio\V -- RaverMeister (label) collection\Vol.1 (1995)


Request: Tokenize Strings (Arrays)

Reply #6
The code I posted is best used for accessing a singular directory level, not for re-creating the directory path. Judging from OPs response, my interpretation of what was wanted was correct.

I don't know what derty is going on about and I suspect he doesn't either  .