• Post Reply Bookmark Topic Watch Topic
  • New Topic

declaring variables  RSS feed

 
Maureen Charlton
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I wish to have the following variables:

char pos1 = reg.charAt(0);
char pos2 = reg.charAt(1);
char pos3 = reg.charAt(2);
char pos4 = reg.charAt(3);
char pos5 = reg.charAt(4);
char pos6 = reg.charAt(5);
char pos7 = reg.charAt(6);

Is there an easier way i.e. shorter than what I have above?
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
char[] pos = reg.toCharArray()
 
Maureen Charlton
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you. I was struggling with the reg.toCharArray( )
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!