Skip to main content

Command Palette

Search for a command to run...

To Lower Case

Published
1 min read
To Lower Case
G

As a Systems Engineer at Tata Consultancy Services, I deliver exceptional software products for mobile and web platforms, using agile methodologies and robust quality maintenance. I am experienced in performance testing, automation testing, API testing, and manual testing, with various tools and technologies such as Jmeter, Azure LoadTest, Selenium, Java, OOPS, Maven, TestNG, and Postman.

I have successfully developed and executed detailed test plans, test cases, and scripts for Android and web applications, ensuring high-quality standards and user satisfaction. I have also demonstrated my proficiency in manual REST API testing with Postman, as well as in end-to-end performance and automation testing using Jmeter and selenium with Java, TestNG and Maven. Additionally, I have utilized Azure DevOps for bug tracking and issue management.

Given a string s, return the string after replacing every uppercase letter with the same lowercase letter.

LeetCode Problem - 709

class Solution {
    public String toLowerCase(String s) {
        StringBuilder sb = new StringBuilder();

        // Loop through each character in the input string
        for (int i = 0; i < s.length(); i++) {
            // Get the current character
            char temp = s.charAt(i);

            // Convert the character to ASCII code
            int tempASCII = (int) temp;

            // Check if the character is an uppercase letter (ASCII range for uppercase letters)
            if (tempASCII > 64 && tempASCII < 91) {
                // Convert the uppercase letter to lowercase by adding the ASCII difference
                int lowercaseASCII = tempASCII + 32;
                // Convert the ASCII code back to character
                char lowercase = (char) lowercaseASCII;
                // Convert the character to a string
                String converted = String.valueOf(lowercase);
                // Append the lowercase character to the StringBuilder
                sb.append(converted);
            } else {
                // If the character is not an uppercase letter, simply append it to the StringBuilder
                sb.append(String.valueOf(temp));
            }
        }

        // Convert the StringBuilder to a string and return
        return sb.toString();
    }
}

More from this blog

S

Software and Performance Testing Insights

462 posts

Results-Driven Agile QA Specialist | Expert in Mobile & Web Testing | Proficient in Test Planning, Execution, and Root Cause Analysis.