Detect and delete spaces infront of / behind a message

Jan 23, 2012 at 8:00pm

Detect and delete spaces infront of / behind a message

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 ?

#61406
Jan 24, 2012 at 12:07am

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.

#221498
Jan 24, 2012 at 4:53am

<3

Thanks heaps :)

#221499

You must be logged in to reply to this topic.