-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path_15_String_Operations.java
38 lines (28 loc) · 1.67 KB
/
_15_String_Operations.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/**
* @author Rajat Verma
* https://www.linkedin.com/in/rajat-v-3b0685128/
* https://github.com/rajatt95
* https://rajatt95.github.io/
*
* Course: Selenium Java Test Framework & Best Practices - Masterclass (https://www.udemy.com/course/selenium-java-test-framework/)
* Tutor: Omprakash Chavan (https://www.udemy.com/user/omprakash-chavan/)
*/
/***************************************************/
package com.learning.java;
public class _15_String_Operations {
static String str = "Hello, Test Automation Engineer!";
public static void main(String[] args) {
System.out.println("str = " + str); // str = Hello, Test Automation Engineer!
System.out.println("str.toLowerCase() = " + str.toLowerCase()); // hello, test automation engineer!
System.out.println("str.toUpperCase() = " + str.toUpperCase()); // HELLO, TEST AUTOMATION ENGINEER!
System.out.println("str.charAt(1) = " + str.charAt(1)); // e
System.out.println("str.substring(5) = " + str.substring(5)); // , Test Automation Engineer!
System.out.println("str.substring(5,11) = " + str.substring(5, 11)); // , Test
System.out.println("str.contains(\"Test\") = " + str.contains("Test")); // true
System.out.println("str.length() = " + str.length()); // 32
System.out.println("str.indexOf('T') = " + str.indexOf('T')); // 7
System.out.println("str.concat(\" -> Rajat\") = " + str.concat(" -> Rajat")); // Hello, Test Automation Engineer! -> Rajat
System.out.println("str.equals(\"Test\") = " + str.equals("Test")); // false
System.out.println("str.equalsIgnoreCase(\"Hi\") = " + str.equalsIgnoreCase("Hi")); // false
}// main
}// class