Sign up to connect with HacruLeian and gain access to their complete profile
  • Member Avatar
    HacruLeian

    Marked Solved Status for getting first char from each word in an input file

    i have a .csv file contain some name as below: William Shakespeare charlie chaplin david Copperfield and i'm supposed to write a java program that will turn the input above …
  • Member Avatar
    HacruLeian

    Replied To a Post in getting first char from each word in an input file

    thank you very much everyone! i figure out how to obtain this output: WS cc dC i reset the Initial = "" after System.out.println (Initial). thank you very much for …
  • Member Avatar
    HacruLeian

    Replied To a Post in getting first char from each word in an input file

    BufferedReader reader = null; String Fullname= "", Initials = "" ; String[] name; try { File csvfile = new File ("sample3.csv"); reader = new BufferedReader(new FileReader(csvfile)); String line = ""; …
  • Member Avatar
    HacruLeian

    Replied To a Post in getting first char from each word in an input file

    while (filescan.hasNext()) { String line = ""; String[] name = line.split(" "); String Name = filescan.next(); for (int i =0; i <Name.length(); i++) { String[] name2 = line.split(" "); ShortenedName …
  • Member Avatar
    HacruLeian

    Replied To a Post in getting first char from each word in an input file

    this is is the newest way i tried: String ShortenedName = ""; Scanner filescan = null; char NameAtFirst; filescan= new Scanner (new File("sample2.csv")); while (filescan.hasNext()) { String line = ""; …
  • Member Avatar
    HacruLeian

    Replied To a Post in getting first char from each word in an input file

    if split and get only the first char of the word is it like this? while ((line = reader.readLine()) != null) { String[] name = line.split(" "); //Fullname = name[0]; …
  • Member Avatar
    HacruLeian

    Replied To a Post in getting first char from each word in an input file

    i've never try coding using the current java before, but i've seen it once when i was searching on the google for this problem. may i know what does this …
  • Member Avatar
    HacruLeian

    Replied To a Post in getting first char from each word in an input file

    i've just eliminate some of the unused variable and some stuff hopefully it look more presentable. about the split with the default separator of space i used it this way …
  • Member Avatar
    HacruLeian

    Replied To a Post in getting first char from each word in an input file

    sorry,i forgot to mention about that.it compile and there's no exception error. the output is wrong. it gave this : S Sc ScC instead of the one i mentioned above. …
  • Member Avatar
    HacruLeian

    Created getting first char from each word in an input file

    i have a .csv file contain some name as below: William Shakespeare charlie chaplin david Copperfield and i'm supposed to write a java program that will turn the input above …

The End.