StringBuilder to Lower Case - Java java.lang

Java examples for java.lang:StringBuilder

Description

StringBuilder to Lower Case

Demo Code


//package com.java2s;

public class Main {
    public static void main(String[] argv) throws Exception {
        StringBuilder builder = new StringBuilder();
        toLowerCase(builder);//from ww w  .  ja  v  a2 s. c o  m
    }

    public static void toLowerCase(StringBuilder builder) {
        for (int i = 0; i < builder.length(); i++) {
            if (Character.isUpperCase(builder.charAt(i))) {
                builder.setCharAt(i,
                        Character.toLowerCase(builder.charAt(i)));
            }
        }
    }
}

Related Tutorials