We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 94a0e82 commit 0c667adCopy full SHA for 0c667ad
Strings/containsSubstring.java
@@ -0,0 +1,32 @@
1
+/*
2
+
3
+program to find if a substring is part of a string and also print the index from which it starts
4
5
+*/
6
7
+package Strings;
8
9
+public class containsSubstring {
10
11
+ public static void main (String[]args) {
12
13
+ check("acknowledge","now");
14
15
+ }
16
17
+ public static void check(String str,String toS) {
18
19
+ str=str.toUpperCase();
20
+ toS=toS.toUpperCase();
21
22
+ int index=-1;
23
+ index=str.indexOf(toS);
24
25
+ if (index!=-1)
26
+ System.out.println("substring found , starts at : "+index);
27
+ else
28
+ System.out.println("substring not found");
29
30
31
32
+}
0 commit comments