iPXE discussion forum

Full Version: Trim whitespaces from a string?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
For some reason, Acer did store the manufacturer and product in my Acer Aspire One as:

"Acer      "
"Aspire one      "

And when outputting this to the screen, the added spaces look weird:

"Acer      Aspire one      boot menu"

I found several settings types which convert the data, e.g. uristring, hex, etc. ... but I didn't find a way to just trim the excessive spaces.

I found this discussion on the mailing list, but the mentioned trick doesn't work anymore and there's no other solution to the problem in that thread. There was also a proposal for a new "trim" command, but that's where the thread ended.

Is there a way to trim whitespaces?
String manipulation functions have not been implemented as we're still discussing how they should be provided to the end-user (API). For now you'll need to send it to a server-side scripting language via HTTP (GET parameters) and truncate them and return a script with them cleaned.
Any progress on this?

I'm hitting the same issue with limited workarounds possible after http://git.ipxe.org/ipxe.git/commitdiff/b5f5f73 got merged.
We're currently running with a forward ported version of the patch by Christian Hesse from 29 Nov 2013.

Unfortunately the patch does seem to break on efi in particular situations.
I'm working on a way to resolve this.
Reference URL's