Forums > MaxMSP

Detect and delete spaces infront of / behind a message

Jan 23 2012 | 8:00 pm

Due to the nature of this problem i have found it really difficult to come up with a search string that brings up any results, so i apologise if this has been answered before.

I am trying to work out a piece of my patch that will get rid of unwanted spaces behind and infront of a message when and IF they exist.

For instance i would like to turn " foo foo" into "foo foo", usually id use sprintf for this sort of thing but i have issues with it when i then try to pass shorter text though the object. For instance after running " foo foo" though then i just run " foo" ill get an output of "foo foo". Ive looked all though the documentation and cant find anything about this.

Is there a better way of getting rid of the space without running into the obvious problems ?

Jan 24 2012 | 12:07 am

Try using the second outlet of [regexp ^\s*(.*)$]

It ignores any number of blank characters if they’re present at the start of a string and spits out just the bits you need.

Jan 24 2012 | 4:53 am


Thanks heaps :)

Viewing 3 posts - 1 through 3 (of 3 total)

Forums > MaxMSP