Results 1 to 2 of 2
  1. #1
    herpeslurpy is offline Member
    Join Date
    Nov 2012
    Posts
    40
    Rep Power
    0

    Default Saving an unspecified sub-string to a new string?

    I have an assignment involving accounting. I need to use data from a file, with a format like this:
    Name, action(set balance, withdraw, deposit), amount, all in one line, and the same string.
    I need to set up individual accounts for each name entered (as they are entered, so there can be as many accounts as necessary).
    But I no idea how to differentiate between the account names, as well as finding the number in it. I'm not all that great with strings and
    methods relating to them. For example, the input would look like this:

    NAME BALANCE 123
    NAME2 BALANCE 4324
    NAME WITHDRAW 70
    NAME 2 DEPOSIT 42

    And so on, like that, but as input all at once from a file. I'm completely lost with this, and I have no idea how I should go about it. Does
    anyone have any ideas or suggestions? If you do, thanks a lot.

  2. #2
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,785
    Rep Power
    7

    Default Re: Saving an unspecified sub-string to a new string?

    Check out the split method. It will return an array with 3 elements (name, action, amount).

Similar Threads

  1. Replies: 2
    Last Post: 04-28-2013, 01:50 AM
  2. Saving string to list to add to file
    By vuzuggu in forum New To Java
    Replies: 1
    Last Post: 11-04-2011, 11:15 AM
  3. Replies: 12
    Last Post: 11-26-2010, 08:33 AM
  4. saving a string data.
    By imorio in forum New To Java
    Replies: 7
    Last Post: 11-18-2010, 11:33 AM
  5. Replies: 1
    Last Post: 11-04-2010, 06:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •