FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Bugs
   Bug Fixes, Implemented Suggestions
(Moderator: fry)
   text() and println()
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: text() and println()  (Read 328 times)
benelek

35160983516098 WWW Email
text() and println()
« on: Jun 18th, 2003, 2:51pm »

as usual, feel free to tell me this isn't a bug.
 
when i try the following code, the letter 'f' is printed on screen, while the number '102' is printed in the prompt... shouldn't println() and text() display the same thing?
 
Code:
//lines[] is an array of String values.
char a=char(int(lines[15].charAt(2)));
text(a,30,50);
println(a);
 
arielm

WWW
Re: text() and println()
« Reply #1 on: Jun 18th, 2003, 4:30pm »

i don't see any bug here...
 
it's just the assumption that println() and text() should display the same thing that seems uncorrect to me:
 
i think println() is simply much smarter, it can take variant types (String, float, etc.) as input, while text() can only accept String or char...
 

Ariel Malka | www.chronotext.org
fry


WWW
Re: text() and println()
« Reply #2 on: Jun 18th, 2003, 5:12pm »

whups, that actually is a bug.. we didn't have a version of print() and println() for char, so instead it was turning the char into an int when it printed to the console. i've just made the fix so it'll be available in rev 56 (available in the next week, hopefully).
 
as always, thanks for the note.. good find..
 
arielm

WWW
Re: text() and println()
« Reply #3 on: Jun 18th, 2003, 9:14pm »

oops! next time i'll be more careful with "assumptions"...
 

Ariel Malka | www.chronotext.org
benelek

35160983516098 WWW Email
Re: text() and println()
« Reply #4 on: Jun 19th, 2003, 12:29am »

lol, dont worry bout it arielm
 
as a matter of curiosity, suppose i had a char, and i wanted to output with text() its numeric value, how would i do it? the old reference section used to have something on this i think, but i can't find it anymore...
 
arielm

WWW
Re: text() and println()
« Reply #5 on: Jun 19th, 2003, 1:24am »

i would make a new assumption stating that, given a char c, the following:
 
Code:
text(new Integer(c).toString(), x, y)

 
could solve the problem (a bit overkill, isn't it?)
 

Ariel Malka | www.chronotext.org
fry


WWW
Re: text() and println()
« Reply #6 on: Jun 19th, 2003, 4:11pm »

yeah, or:
 
text(String.valueOf((int) c), x, y);
 
but it's one of those annoying overkill things in java
 
Pages: 1 

« Previous topic | Next topic »