sτrίkε- Posted April 4, 2013 Posted April 4, 2013 Καλησπερα, θα ηθελα αν καποιος ξερει να μου πει πως μπορω ας πουμε στο 15532 να επιλεξω σαν αποτελεσμα μονο το 2 και αντιστοιχα στην συμβολοσειρα "ΚΩΣΤΑΣ" (π.χ.) πως μπορω να διαλεξω μονο το Α ή μονο το Ω.
xdem Posted April 4, 2013 Posted April 4, 2013 for example this is how substring(int) works: substring(4) will makes ΚΩΣΤΑΣ to ΑΣ, then use startsWith and u get Ω substring(2) will makes ΚΩΣΤΑΣ to ΩΣΤΑΣ use startWith and u get A thats it, but to be more specific you need substring(int, int) so u have to use use substring(4,6) and u get A more easily
sτrίkε- Posted April 5, 2013 Author Posted April 5, 2013 for example this is how substring(int) works: substring(4) will makes ΚΩΣΤΑΣ to ΑΣ, then use startsWith and u get Ω substring(2) will makes ΚΩΣΤΑΣ to ΩΣΤΑΣ use startWith and u get A thats it, but to be more specific you need substring(int, int) so u have to use use substring(4,6) and u get A more easily that's true. Although i have find the answer. substring it's a bit more difficult to do the thing that i requested. charAt() method is better. e.g. String name = strike; int n = 2; System.out.println(charAt(n)); This will make an output "t".
ExTrEmEDwarf Posted April 5, 2013 Posted April 5, 2013 String name = κωστας; int n = 1; System.out.println(charAt(n)); όπου n = και νούμερο γράμματος
Recommended Posts