I was playing around with this new option and got some feedback and a few questions too.
- Instead of throwing an error, could you make it return false or null instead?
Since everything it returns seems to be a string, I was wondering how it could be used as a natural parser for most types.
For example, I was trying to parse sizes, so you could convert a more human-readable file size into a FileSize object without having to write your own parser function.
var t = DOpus.Create().StringTools();
var FSU = DOpus.FSUtil();
var a = '20pib';
DOpus.Output(t.FormatAs(a,'bytes'));
var b = t.FormatAs(a,'num');
DOpus.Output(b);
var c = FSU.NewFileSize(b);
DOpus.Output(c.fmt);
22,517,998,136,852,480 bytes
22,517,998,136,852,480
22 bytes
But using bytes always appends "bytes" at the end, and it's also formatted according to the system locale settings. It looks like using num strips off the unit, but is there a way to get just the number without any separators or units? I know I can clean up all the separators, but I was wondering if there's a built-in way to obtain just the raw value, since IMO the separators don't add up when working with scripting.