• Post Reply Bookmark Topic Watch Topic
  • New Topic

Set a char to empty  RSS feed

 
Anthony Smith
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
char t;
How come I cannot say t = '';
WHat are my alternatives?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66263
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
char is a primitive type that contains a character value. Asking why it cannot be set to "empty" is like asking why an int can't be set to "empty".
The closest approximation is to set it to the null character a la:

hth,
bear
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!