x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Is it possible to format strings?

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!

Product Version: Not Selected
Tags:
more ▼

asked Apr 26 '14 at 10:39 PM in Blueprint Scripting

avatar image

JonathanADaley
644 37 49 77

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

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

more ▼

answered Apr 27 '14 at 10:07 AM

avatar image

Dieselhead
1.2k 27 22 211

avatar image tomofnz Apr 27 '14 at 10:32 AM

Awesome!!!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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

more ▼

answered Apr 21 '16 at 11:59 PM

avatar image

giffen
16 2 3 7

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

alt textuse 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: http://en.wikipedia.org/wiki/Floor_and_ceiling_functions

more ▼

answered Apr 27 '14 at 10:22 AM

avatar image

tomofnz
1.1k 46 47 88

avatar image tomofnz Apr 27 '14 at 11:50 AM

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

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question