Detect and delete spaces infront of / behind a message

BentoSan's icon

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 ?

Luke Hall's icon

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.

BentoSan's icon

Thanks heaps :)