Android String Case Convert flipCase(final String s)

Here you can find the source of flipCase(final String s)

Description

flip Case

License

Open Source License

Declaration

public static String flipCase(final String s) 

Method Source Code

//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License");

public class Main {
    public static String flipCase(final String s) {
        final StringBuilder builder = new StringBuilder(s);
        for (int i = 0; i < s.length(); ++i) {
            char c = builder.charAt(i);
            if (Character.isUpperCase(c)) {
                c = Character.toLowerCase(c);
            } else if (Character.isLowerCase(c)) {
                c = Character.toUpperCase(c);
            }/* w  w w  .  jav a  2  s.  com*/
            builder.setCharAt(i, c);
        }
        return builder.toString();
    }
}

Related

  1. endsWithIgnoreCase(String str, String suffix)
  2. lowercaseKeys(Map map)
  3. startsWithIgnoreCase(String str, String prefix)
  4. toLowerCase(String src)
  5. toUpperCase(String src)
  6. matchesIgnoreCase(String str, String query, int startingAt)
  7. lowerCase(String str)
  8. upperCase(String str)
  9. endsWithIgnoreCase(String source, String suffix)