|
||
|
|||
|
Hi,
Basically I have a text file that I want to read line by line (I have this bit working) and write it to an array. However I want the data from the text file to be split after every character. For example: Text file line 1: ABCDEFG Array: { A, B, C, D, E, F, G} Could anyone give me any help on this? Thanks SJ996
|
|
||||
|
You can get a character at a certain position in the string using the charAt() method:
Java Code
String str = "Hello"; str.charAt(1); // 'e'
__________________
ASCII a question .. Get an ANSI Please surround your code with [highlight=Java]code goes here[/highlight]. |
|
|||
|
Thanks for the replies. this has helped alot.
Does anyone know how to omit the first two lines from the input text file every time? As i do not want these in the array. Scott |
|
||||
|
Use a "dummy read", ie. read them in but don't do anything with that data.
Java Code
// skip two lines myReader.nextLine(); myuReader.nextLine();
__________________
ASCII a question .. Get an ANSI Please surround your code with [highlight=Java]code goes here[/highlight]. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [SOLVED] Create new Array from old Array | satory | Collections and Generics | 1 | 24-02-2010 04:44 PM |
| Problems with File Reader (Strings and 2D Array Storage) | K0209 | File I/O & Other I/O Streams | 44 | 12-01-2010 02:48 PM |
| unable to move xls file(file name has space in between) from input folder to back up | raji | What's Wrong With My Code? | 8 | 06-01-2010 01:59 PM |
| Object array to int array? | rsala004 | Collections and Generics | 1 | 30-10-2009 08:09 AM |
| Storing an array into an array | vluong | Collections and Generics | 4 | 22-09-2009 07:14 PM |
|
100 most searched terms
Search Cloud
|
| 2 dimensional arraylist java 2d arraylist java actionlistener actionlistener in java addactionlistener addactionlistener java convert double to integer java double format java double to integer in java double to integer java drag en drop programmeren java eclipse shortcut keys exception in thread "awt-eventqueue-0" java.lang.outofmemoryerror: java heap space exception in thread "main" java.lang.nullpointerexception exception in thread "main" java.lang.outofmemoryerror: java heap space format double in java format double java get mouse position java java 2d arraylist java actionlistener java double format java double formatting java double to int java double to integer java format double java forum java forums java get mouse position java list to map java mouse position java programming forum java programming forums java programming practice problems java send keystrokes to another application java two dimensional arraylist java.io.ioexception: premature eof java.lang.classformaterror: truncated class file java.lang.outofmemoryerror: java heap space java.util.arraylist jbutton action jbutton actionlistener jtextarea font jtextfield font size jxl.read.biff.biffexception: unable to recognize ole stream programming mutators and generics smack api two dimensional arraylist two dimensional arraylist java unable to sendviapost to url what is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? |