Jump to content

Recommended Posts

Posted

Καλησπερα, θα ηθελα αν καποιος ξερει να μου πει πως μπορω ας πουμε στο 15532 να επιλεξω σαν αποτελεσμα μονο το 2 και αντιστοιχα στην συμβολοσειρα "ΚΩΣΤΑΣ" (π.χ.) πως μπορω να διαλεξω μονο το Α ή μονο το Ω.

Posted

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

Posted

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".

Guest
This topic is now closed to further replies.


×
×
  • Create New...