Created
May 6, 2016 02:26
-
-
Save elyosemite/f034aa7980564bd1c3f1859e757bdea2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Scanner; | |
| public class ManipulacaoStrings { | |
| static boolean verificarEmail(String email){ | |
| int contA = 0; | |
| for (int i = 0; i<email.length(); i++){ | |
| if (email.charAt(i)=='@') | |
| contA++; | |
| } | |
| if (contA == 1) | |
| return true; | |
| return false; | |
| } | |
| /** | |
| * @param args the command line arguments | |
| */ | |
| public static void main(String[] args) { | |
| String nome; | |
| Scanner entrada = new Scanner(System.in); | |
| int cont =0 ; | |
| System.out.println("Informe o nome: "); | |
| nome = entrada.nextLine(); | |
| System.out.println("Mensagem em maisculo: "+nome.toUpperCase()); | |
| for (int i =0; i< nome.length(); i++){ | |
| if (nome.charAt(i) == 'a' || nome.charAt(i)=='A') | |
| cont++; | |
| } | |
| System.out.println("Numero de letras a digitadas: "+cont); | |
| System.out.println("Inverso do texto: "); | |
| for (int i = nome.length()-1; i>=0; i--){ | |
| System.out.println(nome.charAt(i)); | |
| } | |
| String email = ""; | |
| String senha = ""; | |
| System.out.println("Informe o email: "); | |
| email = entrada.next(); | |
| if (verificarEmail(email) == true) | |
| System.out.println("Email valido"); | |
| else | |
| System.out.println("Email invalido"); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment