code: @Nullable
    public static String getAsIdentifier (@Nullable final String s, final char cReplacement)
    {
      if (StringHelper.hasNoText (s))
        return s;
  
      String sReplacement;
      if (cReplacement == '$' || cReplacement == '\\')
      {
        // These 2 chars must be quoted, otherwise an
        // StringIndexOutOfBoundsException occurs!
        sReplacement = "\\" + cReplacement;
      }
      else
        sReplacement = Character.toString (cReplacement);
  
      // replace all non-word characters with the replacement character
      // Important: quote the replacement in case it is a backslash or another
      // special regex character
      final String ret = stringReplacePattern ("\\W", s, sReplacement);
      if (!Character.isJavaIdentifierStart (ret.charAt (0)))
        return sReplacement + ret;
      return ret;
    }
docs: Convert an identifier to a programming language identifier by replacing all
  non-word characters with an underscore.
  
  @param s
  The string to convert. May be <code>null</code> or empty.
  @param cReplacement
  The replacement character to be used for all non-identifier
  characters
  @return The converted string or <code>null</code> if the input string is
  <code>null</code>.