# About StringTools.FormatAs()

**URL:** <https://resource.dopus.com/t/about-stringtools-formatas/60658>\
**Category:** Help & Support\
**Tags:** script\
**Created:** [October 9, 2026, 2:17am UTC](https://resource.dopus.com/t/about-stringtools-formatas/60658 "2026-10-09T02:17:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![errante](https://resource.dopus.com/user_avatar/resource.dopus.com/errante/32/61692_2.png) [@errante](https://resource.dopus.com/u/errante)\
**Post date:** [October 9, 2026, 2:17am UTC](https://resource.dopus.com/t/about-stringtools-formatas/60658/1 "2026-10-09T02:17:46Z")

</div>

I was playing around with this new option and got some feedback and a few questions too.

1. 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.

```javascript
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.

---

<div class="post-metadata">

**Author:** ![Jon](https://resource.dopus.com/user_avatar/resource.dopus.com/jon/32/12713_2.png) [@Jon](https://resource.dopus.com/u/Jon)\
**Post date:** [November 18, 2026, 5:30am UTC](https://resource.dopus.com/t/about-stringtools-formatas/60658/2 "2026-11-18T05:30:55Z")

</div>

You should be able to use `'#0'` to format as a raw number with no separators.
