Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

splitting a string into two 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
 
Henry Wong
author
Marshal
Pie
Posts: 21214
81
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Selva Kumar Sundram:
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


Have you taken a look at the split() method -- of the String class?

Henry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic