Java Integer Mod modifyBase32AtIndex(final String s, final int index)

Here you can find the source of modifyBase32AtIndex(final String s, final int index)

Description

Changes a single character in the specified base 32 string.

License

Open Source License

Parameter

Parameter Description
s A base 32 string
index The index of the character to change

Return

The resulting base 32 string

Declaration

public static String modifyBase32AtIndex(final String s, final int index) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**//from ww w.j a  va2 s .  c  o m
     * Changes a single character in the specified base 32 string.
     *
     * @param s A base 32 string
     * @param index The index of the character to change
     * @return The resulting base 32 string
     */
    public static String modifyBase32AtIndex(final String s, final int index) {
        final char[] chars = s.toCharArray();
        final char currentChar = chars[index];

        char newChar = (char) (currentChar + 1);
        switch (currentChar) {
        case 'Z':
        case '7':
            newChar = 'A';
        }

        chars[index] = newChar;
        return new String(chars);
    }
}

Related

  1. modByPowerOfTwo(int value, int mod)
  2. modCeil(int x, int mod)
  3. mode(final StringBuilder buffer, final int mode)
  4. ModEuclidean(int D, int d)
  5. modifyAlpha(int color, int alpha)
  6. modifyDummyString(String dummyString, int beginTag, int endTag)
  7. modifyPublicPortCheckRange(String modifiedVal, int dashCnt)
  8. modifyString(char firstCharacter, String srcString, int indexOfSubstring)
  9. modInverse(int a, int n)