Hi,
I'm having a problem with a program I'm making for a class. Basically what it does is read in a file using JFileChooser and load the level in the file. The format for the filename is "levelX.lvl" where X is the level number.
For example,
level0.lvl
level1.lvl
...
level10.lvl
level11.lvl
etc...
Now based on the number in the filename, I need to set a variable curLevel to that number. That way the game knows that it is running that level.
I know how to save the filename to a string. But how can I strip that string of everything but the numbers?
Thanks in advance.
I'm having a problem with a program I'm making for a class. Basically what it does is read in a file using JFileChooser and load the level in the file. The format for the filename is "levelX.lvl" where X is the level number.
For example,
level0.lvl
level1.lvl
...
level10.lvl
level11.lvl
etc...
Now based on the number in the filename, I need to set a variable curLevel to that number. That way the game knows that it is running that level.
I know how to save the filename to a string. But how can I strip that string of everything but the numbers?
Thanks in advance.