If say comment on mp3 is A-Z, its writing all of it on single line.
I want it to write 75 characters of comment between '|' and '|' and then change the line with again front and end border and remaining comment between these and so on.
If say comment on mp3 is A-Z, its writing all of it on single line.
I want it to write 75 characters of comment between '|' and '|' and then change the line with again front and end border and remaining comment between these and so on.
Any help would be much appreciated.
To cut a comment at position 75, use $left(%comment%,75)
To continue with the rest: $mid(%comment%,76,$len(%comment%)
To write the | at the end, calculate the maximum length minus the length of the sub-string: $sub(75,$len($mid(%comment%,76,$len(%comment%))))
This is another example ... $regexp($repeat('a large stream of text ',20),'(.{1,75})(?:\s+|$[\r\n]?)|(.{1,75})','$1$2\r\n')
The special task is to make each line the same width, for example by adding some space characters at end of each text line, then right cut the line to the wanted length.
If you want to put one pipe character at the beginning and at the end of each textline, ...
so you have to replace each CRLF sequence with a sequence of ... '|'$char(13)$char(10)'|'
... to get one pipe character at end of a line and one pipe character in front of the next line.
At last add one pipe character at the very beginning of the text ...
(... and maybe one pipe character at the very end of the text).
Hi, Thanks a lot for helping me. It is exactly what I wanted.
One problem though, whats CRLF sequence and how to repalce it?
EDIT: Also need the lines to start from 7th charater point, I am already putting this code on 7th character so first line is not a problem but rest of the text starts from 1st point.
The end of a text line, in Windows environment, is mostly a sequence of two characters:
$char(13) ... CR ... Carriage Return
$char(10) ... LF ... Linefeed
Try to add 7 space characters just following the LF character, e. g. ...
$replace('the given text here',$char(10),$char(10)$repeat($char(32),7))
Probably the given text has no CRLF sequences?
Well, it looks like as if you have opened a big problem for you, regarding text manipulation.
I tend to say, leave the given text as is, ... and do not to try to make cosmetic pastels.
You will get even more difficulties when you want to cut the line length for each line to the same length.
While in a Google search there was shown a hint to a user created Mp3tag MTE script, which creates a HTML page, which in turn may display a floating text stream within a textbox, where the text has been framed by ASCII box characters, ready made for usage as NFO text file. Search for "fastnfo".
Want to put the text in centre of 7th and 75th character, so it looks balanced from both the sides, also will use the $regex code in your previous post to truncate the words after 70th character and do the remaining from next line. Any idea how to edit your previous $regex code to do the centre text?
The following steps are just a proposal to be modified by yourself.
TEST <== $repeat('a large stream of text ',20)
TEST <== $regexp(%TEST%,'(.{1,75})(?:\s+|$[\r\n]?)|(.{1,75})','$1$2\r\n')
TEST <== $replace(%TEST%,$char(13),$repeat($char(32),75)$char(13))
TEST <== $regexp(%TEST%,'(.{1,75})(\s*)(\r\n)','$1$3')
TEST <== $trimRight('|'$regexp(%TEST%,'\r\n','|\r\n|'),'|')
|a large stream of text a large stream of text a large stream of text a |
|large stream of text a large stream of text a large stream of text a large |
|stream of text a large stream of text a large stream of text a large stream|
|of text a large stream of text a large stream of text a large stream of |
|text a large stream of text a large stream of text a large stream of text a|
|large stream of text a large stream of text a large stream of text a large |