FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JavaProgramming/Strings/DeleteSomePart.java at main · karterhhgg/JavaProgramming · GitHub
karterhhgg
/
JavaProgramming
Public
Notifications
You must be signed in to change notification settings
Fork
8
Star
1
Code
Pull requests
6
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
JavaProgramming
/
Strings
/
DeleteSomePart.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
24 lines (21 loc) · 787 Bytes
Breadcrumbs
JavaProgramming
/
Strings
/
DeleteSomePart.java
Copy path
File metadata and controls
24 lines (21 loc) · 787 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//Input an email from the user. You have to create a username from the
//email by deleting the part that comes after ‘@’. Display that username to the user.
//Example : email = “apnaCollegeJava@gmail.com” ; username = “apnaCollegeJava”
//email = “helloWorld123@gmail.com”; username = “helloWorld123”
package
Strings
;
import
java
.
util
.*;
public
class
DeleteSomePart
{
public
static
void
main
(
String
[]
args
) {
Scanner
sc
=
new
Scanner
(
System
.
in
);
String
email
=
sc
.
next
();
String
userName
=
""
;
for
(
int
i
=
0
;
i
<
email
.
length
();
i
++){
if
(
email
.
charAt
(
i
) ==
'@'
){
break
;
}
else
{
userName
+=
email
.
charAt
(
i
);
}
}
System
.
out
.
println
(
userName
);
}
}
Back
|
FazBrowse Home
|
New Git URL