移除字符串中的字符和移除字符串数组中的字符,移除数组
移除字符串中的字符和移除字符串数组中的字符,移除数组
/**
* Remove a SASL mechanism from the list to be used.
*
* @param mech the SASL mechanism to be removed
*/
public static void removeSaslMech(String mech) {
if( defaultMechs.contains(mech) ) {
defaultMechs.remove(mech);
}
}
/**
* Remove a Collection of SASL mechanisms to the list to be used.
*
* @param mechs the Collection of SASL mechanisms to be removed
*/
public static void removeSaslMechs(Collection<String> mechs) {
for(String mech : mechs) {
removeSaslMech(mech);
}
}
#include <stdio.h>
#include <ctype.h>
void DeleteLower( char acstr[], int iCount )
{
int iTemp = 0;
char acTemp[30] = {0};
printf("您输入的字符串:%s\n",acstr);
for ( int i = 0; i < iCount; ++i )
{
if ( !(islower(acstr[i])) )
{
acTemp[iTemp] = acstr[i];
iTemp++;
}
}
printf("删除后的字符串:%s\n",acTemp);
}
void main()
{
printf("请输入字符串(小于30)\n");
char acstr[30] = {0};
scanf("%s",acstr);
DeleteLower(acstr,30);
}
我举个例子啊:
#include <stdio.h>
#include <string.h>
int main()
{
char a[10] = {"1234567890"};
int i, j;
for(i = 0; i < strlen(a); i++)
{
if(a[i] == '7')
{
for(j = i; j < strlen(a) - 1; j++)
{
a[j] = a[j + 1];
}
a[j] = '\0';
break;
}
}
for(i = 0; i < strlen(a); i++)
{
printf("%c ", a[i]);
}
printf("\n");
return 0;
}
//希望楼主能明白啊,我直接在上面敲得代码,不知道能不能编译通过啊,请谅解,没编译器(在网吧)
用户评论