• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to generate names automatically in a function  RSS feed

 
Pooja Patole
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,



In the above code snippet i want to create 4 projects and am passing the name of the project as argument. But the problem is only one project is being created with that name as the name of project should be unique. I want to generate the projects automatically so i so not want to give the names everytime.How should i generate names programatically?


Thanks..
 
Swastik Dey
Rancher
Posts: 1812
15
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pooja,

What is createProject method doing? How does it function? Can you show the code of the method?
 
Pooja Patole
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its creates the project.. Actually the code is in different classes and its very big so am finding it diffeicult to paste.. I tried appending the name with +i and so after every name a number was being appended. And it worked
 
Riaan Nel
Ranch Hand
Posts: 160
IntelliJ IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pooja Patole wrote:Hello everyone,



In the above code snippet i want to create 4 projects and am passing the name of the project as argument. But the problem is only one project is being created with that name as the name of project should be unique. I want to generate the projects automatically so i so not want to give the names everytime.How should i generate names programatically?


Thanks..

Pooja, I doubt that anyone here will know what you mean when you refer to a "Project". If you're asking how to give pass a unique String into the createProject() method in each iteration of your loop, you can just append the counter.

Edit: Nevermind, I only saw your second post now.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!