cut a symbol after n characters
how do i cut a symbol after n characters (so that for example words end after 10 characters) while avoiding to split it into a list of characters?
JavaScript has methods slice() and substr() for obtaining a part of a string.
function anything()
{
outlet(0,messagename.slice(0,10));
}
Roman, what's wrong with lists of char?
Another way is to use regexp .{10} like this:
it is for something which is uzi´ed ... i want to write 20-30 files to disk at once. and actually i dont find a good way to get it into a list of characters either. i mostly use OS9 so i dont know much about java or regexp ... but this is for a Max 6 project, so i will probably use regexp.
thanks for your examples - but feel free to add more.
[jit.str.msymbol] could be of some help, might need some specific formating as you may notice in the example :
looks cool, but i dont fully get it.
why is "jit.matrix 1 char 10 1" also removing the 3th , the 5th and the 8th character in addition to limiting the whole thing to 10?
Due to lack of time it was a quick response pointing to one direction. that is why i mentioned it needed some formating. i actually did a mistake putting in the jit.matrix between the two jit.str objects which created the unexpected behaviours you mentioned.
here is a better solution still in the jit.str "paradigm".
Notice that spaces are counted as characters.
Also jasch's [strcut] external does exactly what you need.
from its help file :
"terminate string at position - arguments: position (int) default 0, mode (0/1) default 0"
Not too late for me... thanks Fora.
You're welcome! ;)
Still useful Fora!