Efficient TRIM?
Posted:
Thu Nov 17, 2016 1:46 pm
by Electroguard
I need to trim an unwanted space character from the end of a payload string (and have a similar need to trim the front).
I've got something bloaty that works:
Code: Select allif asc(right(payload,1)) < 33 then payload = left(payload,len(payload) - 1) 'trim space or control character from right end
...but it weighs a ton and takes an age, so can someone suggest anything better please?
Re: Efficient TRIM?
Posted:
Thu Nov 17, 2016 6:43 pm
by Mmiscool
I am uploading a new build now that includes a trim function.
Code: Select allbla = " hello world "
print trim(bla)
Re: Efficient TRIM?
Posted:
Thu Nov 17, 2016 6:52 pm
by Electroguard
Brilliant, thank you very much.
Re: Efficient TRIM?
Posted:
Thu Nov 17, 2016 7:28 pm
by Electroguard
Umm, while that TRIM is still fresh in mind, what's the chances of a similar SNIP clone which snips off a specified number of characters from the head or tail of the specified variable, eg: SNIP(payload,num) where pos and neg numbers snipped from different ends?
I'll understand you swearing at me under your breath, but you'd probably swear a lot more if I waited till your mind was elsewhere before suggesting it as a feature request!