# Is it possible to format strings?

**URL:** <https://forums.unrealengine.com/t/is-it-possible-to-format-strings/281758>\
**Category:** Blueprint\
**Tags:** string, format, unreal-engine, Blueprint, question\
**Created:** [April 26, 2014, 10:39pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-format-strings/281758 "2014-04-26T22:39:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_bcd0d281](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_bcd0d281](https://forums.unrealengine.com/u/anonymous_user_bcd0d281)\
**Post date:** [April 26, 2014, 10:39pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-format-strings/281758/1 "2014-04-26T22:39:44Z")

</div>

Is there a way, in Blueprint, to format strings? More specifically, I want to take the float value that is returned by “Get Game Time in Seconds”, convert it to a string, and only have the whole number and first two decimal places of the float value put into the string. Can you do that in Blueprint, or would you have to dip into C++?

Thanks!

---

<div class="post-metadata">

**Author:** ![Dieselhead](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dieselhead](https://forums.unrealengine.com/u/Dieselhead)\
**Post date:** [April 27, 2014, 10:07am UTC](https://forums.unrealengine.com/t/is-it-possible-to-format-strings/281758/2 "2014-04-27T10:07:11Z")

</div>

This will find the full seconds and the decimals, and then build a string with them.

 ![4947-screenshot+2014-04-27+12.04.55.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/3/7/5375bcf9523961e31ce5cce71d887d961d5bc95d.png)

---

<div class="post-metadata">

**Author:** ![tomofnz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tomofnz](https://forums.unrealengine.com/u/tomofnz)\
**Post date:** [April 27, 2014, 10:22am UTC](https://forums.unrealengine.com/t/is-it-possible-to-format-strings/281758/3 "2014-04-27T10:22:25Z")

</div>

![4958-capturesecondsstring.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/5/9/759ea4bc0feaf3bdb447a97fadba4076740e9399.png)

use **get substring** to give a new string which includes only the first N characters based on the first string … also play with using the **LEN** value, or something like that, to get the length of the string

If you are wondering what is a **Floor** function, it’s a maths term kind of like truncate, so it would convert 1.01 into 1 (seconds)  
In the image provided therefore 1.01 (time) - 1 (result of floor of time) gives .01 (decimal)

You may want to think about how do you filter 001, 010, 100 etc.  
And do you need minutes (compareint if seconds = 60)

See the examples here: [[Floor and ceiling functions - Wikipedia](http://en.wikipedia.org/wiki/Floor_and_ceiling_functions)

---

<div class="post-metadata">

**Author:** ![tomofnz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tomofnz](https://forums.unrealengine.com/u/tomofnz)\
**Post date:** [April 27, 2014, 10:32am UTC](https://forums.unrealengine.com/t/is-it-possible-to-format-strings/281758/4 "2014-04-27T10:32:43Z")

</div>

Awesome!!!

---

<div class="post-metadata">

**Author:** ![tomofnz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tomofnz](https://forums.unrealengine.com/u/tomofnz)\
**Post date:** [April 27, 2014, 11:50am UTC](https://forums.unrealengine.com/t/is-it-possible-to-format-strings/281758/5 "2014-04-27T11:50:28Z")

</div>

You can see my **24 hour clock** by the way – it doesn’t do decimals, but you could merge it in with the above stuff if you wanted to show days, hours, minutes, seconds + decimals.

Link (p40) [http://goo.gl/jEHT0u](http://goo.gl/jEHT0u)

---

<div class="post-metadata">

**Author:** ![giffen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@giffen](https://forums.unrealengine.com/u/giffen)\
**Post date:** [April 21, 2016, 11:59pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-format-strings/281758/6 "2016-04-21T23:59:30Z")

</div>

You could take your float and use a ToText(float) node (which has formatting options) and then cast that to a string.
