Assignment
University
California State UniversityCourse
COMP 182 | Data Structures and Program Design and LabPages
2
Academic year
2023
KauK
Views
25
import java . util . Scanner ; public class Lab2_2 { public static void main ( String [] args ) { Scanner stdin = new Scanner ( System . in ); System . out . print ( "Please type in a string: " ); String input = stdin . nextLine (); String result = "" ; char currentChar ; for ( int i = 0 ; i < input . length (); i ++) { currentChar = input . charAt ( i ); if ( currentChar >= 'A' && currentChar <= 'z' ) { result += currentChar ; } } System . out . println ( "The result is " + result ); } }
COMP 182: Lab Assignment 2.2 - Remove All Non Alpha Characters
Please or to post comments