iPXE discussion forum
Trim whitespaces from a string? - Printable Version

+- iPXE discussion forum (https://forum.ipxe.org)
+-- Forum: iPXE user forums (/forumdisplay.php?fid=1)
+--- Forum: General (/forumdisplay.php?fid=2)
+--- Thread: Trim whitespaces from a string? (/showthread.php?tid=7979)



Trim whitespaces from a string? - mbirth - 2016-03-05 01:42

For some reason, Acer did store the manufacturer and product in my Acer Aspire One as:

Code:
"Acer      "
"Aspire one      "

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

Code:
"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?


RE: Trim whitespaces from a string? - robinsmidsrod - 2016-03-17 13:21

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.


RE: Trim whitespaces from a string? - sspans - 2016-05-24 07:12

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.

https://gist.github.com/sspans/afbfb93878e068cfe5cdaa78b0378634


RE: Trim whitespaces from a string? - sspans - 2016-06-10 13:56

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