greetings
i'd like to pad a string... say for instance i want to pad the string "andy" and "ian" to be able to have a total of 10 characters, and the padding character will be an underscore. so the end result would add 6 underscores to the string "andy" and seven underscores to the string "ian": "andy______" "ian_______"
i poked around through extended and did a search on the list archives for "character pad" and "string pad", nothing came up in the archives, and the only things i found in extended are mrpeach's [str] help examples, and moocow's [string2any], [any2string] help examples. it looks like mrpeach's stuff is the closest to what i want, but i don't think it's what i want. after tofofmtl introduced me to pdmtl, i expected there would be some string handling in to coincide with the list stuff they have too, but nothing there.
thanks, andy
moin Andy,
This is quite easy using [string2any] and [any2string] together with pd's [list] operations. see attached example patch. I'm sure the same basic idea can be used to pad [str] strings as well...
marmosets, Bryan
On 2007-12-16 20:54:20, "Andy Graybeal" andy.graybeal@casanueva.com appears to have written:
greetings
i'd like to pad a string... say for instance i want to pad the string "andy" and "ian" to be able to have a total of 10 characters, and the padding character will be an underscore. so the end result would add 6 underscores to the string "andy" and seven underscores to the string "ian": "andy______" "ian_______"
i poked around through extended and did a search on the list archives for "character pad" and "string pad", nothing came up in the archives, and the only things i found in extended are mrpeach's [str] help examples, and moocow's [string2any], [any2string] help examples. it looks like mrpeach's stuff is the closest to what i want, but i don't think it's what i want. after tofofmtl introduced me to pdmtl, i expected there would be some string handling in to coincide with the list stuff they have too, but nothing there.
thanks, andy
thank you! "....iiinterressstinngg...."
even more too meditate on, thanks bryan (i see your name everytime i start PD btw)
-andy
moin Andy,
This is quite easy using [string2any] and [any2string] together with pd's [list] operations. see attached example patch. I'm sure the same basic idea can be used to pad [str] strings as well...
marmosets, Bryan
On 2007-12-16 20:54:20, "Andy Graybeal" andy.graybeal@casanueva.com appears to have written:
greetings
i'd like to pad a string... say for instance i want to pad the string "andy" and "ian" to be able to have a total of 10 characters, and the padding character will be an underscore. so the end result would add 6 underscores to the string "andy" and seven underscores to the string "ian": "andy______" "ian_______"
i poked around through extended and did a search on the list archives for "character pad" and "string pad", nothing came up in the archives, and the only things i found in extended are mrpeach's [str] help examples, and moocow's [string2any], [any2string] help examples. it looks like mrpeach's stuff is the closest to what i want, but i don't think it's what i want. after tofofmtl introduced me to pdmtl, i expected there would be some string handling in to coincide with the list stuff they have too, but nothing there.
thanks, andy
-- Bryan Jurish "There is *always* one more bug." jurish@ling.uni-potsdam.de -Lubarsky's Law of Cybernetic Entomology
Is it the best method ? I'm not sure. Is it what you are looking for ? ++
Jack
Le 16 déc. 07 à 20:54, Andy Graybeal a écrit :
greetings
i'd like to pad a string... say for instance i want to pad the string "andy" and "ian" to be able to have a total of 10 characters, and the padding character will be an underscore. so the end result would
add 6 underscores to the string "andy" and seven underscores to the string "ian": "andy______" "ian_______"i poked around through extended and did a search on the list
archives for "character pad" and "string pad", nothing came up in the archives,
and the only things i found in extended are mrpeach's [str] help examples, and moocow's [string2any], [any2string] help examples. it looks like mrpeach's stuff is the closest to what i want, but i don't think
it's what i want. after tofofmtl introduced me to pdmtl, i expected there
would be some string handling in to coincide with the list stuff they have
too, but nothing there.thanks, andy
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/ listinfo/pd-list
wow, thank you :)
I've never used [s2l], [list-len], [Uzi], [last-x], [Append], or [prepend set] ..... lots of new goodies to look at!
thanks alot, this looks like exactly what i wanted. i will now meditate on the patch for some time.
-andy
Is it the best method ? I'm not sure. Is it what you are looking for ? ++
Jack
Le 16 déc. 07 à 20:54, Andy Graybeal a écrit :
greetings
i'd like to pad a string... say for instance i want to pad the string "andy" and "ian" to be able to have a total of 10 characters, and the padding character will be an underscore. so the end result would add 6 underscores to the string "andy" and seven underscores to the string "ian": "andy______" "ian_______"
i poked around through extended and did a search on the list archives for "character pad" and "string pad", nothing came up in the archives, and the only things i found in extended are mrpeach's [str] help examples, and moocow's [string2any], [any2string] help examples. it looks like mrpeach's stuff is the closest to what i want, but i don't think it's what i want. after tofofmtl introduced me to pdmtl, i expected there would be some string handling in to coincide with the list stuff they have too, but nothing there.
thanks, andy
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/ listinfo/pd-list
A small abstraction, here :) ++
Jack
Le 16 déc. 07 à 22:27, Andy Graybeal a écrit :
wow, thank you :)
I've never used [s2l], [list-len], [Uzi], [last-x], [Append], or
[prepend set] ..... lots of new goodies to look at!thanks alot, this looks like exactly what i wanted. i will now
meditate on the patch for some time.-andy
Is it the best method ? I'm not sure. Is it what you are looking for ? ++
Jack
Le 16 déc. 07 à 20:54, Andy Graybeal a écrit :
greetings
i'd like to pad a string... say for instance i want to pad the
string "andy" and "ian" to be able to have a total of 10 characters, and
the padding character will be an underscore. so the end result would add 6 underscores to the string "andy" and seven underscores to the string "ian": "andy______" "ian_______"i poked around through extended and did a search on the list archives for "character pad" and "string pad", nothing came up in the archives, and the only things i found in extended are mrpeach's [str] help
examples, and moocow's [string2any], [any2string] help examples. it looks like mrpeach's stuff is the closest to what i want, but i don't think it's what i want. after tofofmtl introduced me to pdmtl, i expected there would be some string handling in to coincide with the list stuff they have too, but nothing there.thanks, andy
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/ listinfo/pd-list
Hallo, Andy Graybeal hat gesagt: // Andy Graybeal wrote:
i'd like to pad a string... say for instance i want to pad the string "andy" and "ian" to be able to have a total of 10 characters, and the padding character will be an underscore. so the end result would add 6 underscores to the string "andy" and seven underscores to the string "ian": "andy______" "ian_______"
You may need to find some external that will give you the length of a symbol. Then substract that from your desired total length, make a list of that length with your symbol and use [list-l2s] from list-abs to build a single symbol out of your original string and the padding.
Or just install pdlua and use attached lua-external. Once you've install pdlua, you can do all kinds of string/symbol processing using Lua's string library easily.
Frank Barknecht _ ______footils.org__