Answers for "find the first letter of every strin in java"

12

get first 5 characters of string java

firstFourChars = input.substring(0, 4);
Posted by: Guest on March-24-2020
1

get first letter of string in array java

// Array of names
		String name [] = {"Clark", "Bruce", "Diana", "Barry"};
		
		// for each loop (to iterate everything inside the array)
		for (String firstChar: name) {
			System.out.println(firstChar.charAt(0));
		}

		/* Prints
        	C
            B
            D
            B
        */
Posted by: Guest on February-09-2022

Code answers related to "find the first letter of every strin in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language