/** * Returns the index within this string of the last occurrence of the * specified string. * The search is done ignore the character case. * @param source the string to search * @param str the string to search for * @return the index of the first occurrence of the string in the * character sequence represented by this object, or * <code>-1</code> if the string does not occur. * @ibm-api */ public static int lastIndexOfIgnoreCase(String source, String str) { return lastIndexOfIgnoreCase(source, str, source.length()); }
/** * Returns the index within this string of the last occurrence of the * specified string. * The search is done ignore the character case. * @param source the string to search * @param str the string to search for * @return the index of the first occurrence of the string in the * character sequence represented by this object, or * <code>-1</code> if the string does not occur. * @ibm-api */ public static int lastIndexOfIgnoreCase(String source, String str) { return lastIndexOfIgnoreCase(source, str, source.length()); }
/** * Update Community Logo, supported for connections * * @param file * image to be uploaded as Community Logo * @param communityId * @throws ClientServicesException */ public void updateCommunityLogo(java.io.File file, String communityId) throws ClientServicesException{ Map<String, String> parameters = new HashMap<String, String>(); parameters.put(COMMUNITY_UNIQUE_IDENTIFIER, communityId); String name = file.getName(); int dot = StringUtil.lastIndexOfIgnoreCase(name, "."); String ext = ""; if (dot > -1) { ext = name.substring(dot + 1); // add one for the dot! } if (!StringUtil.isEmpty(ext)) { Map<String, String> headers = new HashMap<String, String>(); if (StringUtil.equalsIgnoreCase(ext,"jpg")) { headers.put("Content-Type", "image/jpeg"); // content-type should be image/jpeg for file extension - jpeg/jpg } else { headers.put("Content-Type", "image/" + ext); } // the url doesn't have atom in base String url = "/communities/service/html/image"; getClientService().put(url, parameters, headers, file, ClientService.FORMAT_NULL); } }
int dot = StringUtil.lastIndexOfIgnoreCase(name, DOT); String ext = ""; if (dot > -1) {