We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
long to String (Read 541 times)
long to String
Dec 30th, 2009, 5:09pm
 
hi,

Sorry about this question, but i'm a complete noob with Processing. I tried to find a sollution on this forum, but couldn't find anything that fixes it.
I want to make a string of a list of filesizes. The filenames where easy, but i tried this, because i saw that if i added the "s" it removes a .0 after the file size

   long sizeFile = f.length();
   String imagesSize = "s"+sizeFile;
   println(imagesSize);

output:

s149147
s171974
s157381

If i remove the "s" it gives an error and says it's an long value.

println(f.length());

gives:

149147.0
171974.0
157381.0

I don't see any places into the string like the image files:
[117] "img97.jpg"
[118] "img98.jpg"
[119] "img99.jpg"
Re: long to String
Reply #1 - Dec 30th, 2009, 10:12pm
 
Does "String imagesSize = "" + sizeFile;" do what you need?

You could also use str() to convert from a number to a String (if I understand your question).
http://processing.org/reference/str_.html
Page Index Toggle Pages: 1