#I'm having some issues with string manipulation
10 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @tough flower! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
import java.util.Scanner;
public class Stringmanipulation{
public static void main(String[] agrs)
String Username = "Andromeda";
String otherUsername = "Shadius";
int lengthOfString;
char characterFromString;
String substringFromString;
System.out.println("Are the two strings equivalent? (same content):" + Username.equals(otherUsername) );
System.out.println("Computing how many characters are in the string" );
System.out.println(Username + " = " + Username.length());
System.out.println(otherUsername + " = " + otherUsername.length());
System.out.println("Retrieving the character at index 0" );
System.out.println(Username + " = " + Username.charAt(0));
System.out.println(otherUsername + " = " + otherUsername.charAt(0));
System.out.println("Getting a substring" );
System.out.println(Username + " = " + Username.substring(3,7));
System.out.println(otherUsername + " = " + otherUsername.substring(otherUsername.length() - 2));
}