get first 5 characters of string java
firstFourChars = input.substring(0, 4);
get first 5 characters of string java
firstFourChars = input.substring(0, 4);
get first character of string java
var string = "freeCodecamp";
string.charAt(0); // Returns "f"
first character string number java
String myString = "1253";
if(Character.isDigit(myString.charAt(0))){
System.out.println("First character of string is a number");
}
else{
System.out.println("First character of string is not a number");
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us