• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

splitting string into 2 variable

 
Selva Kumar Sundram
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i manage to read a textfile with my program which is a string that looks like this: stuck in a hole in the backyard;60173317358
i want to save stuck in a hole in the backyard in variable x and 60173317358 in variable y. can anyone tell me how to do this? thanks in advance
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The String class has two methods that will help you with this: indexOf and substring. With these two, can you think of a way to do this?
 
Edwin Dalorzo
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about the split() method in the String class?

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic