Remove characters from a string, remove characters from a string array, and remove an array.
/**
* Remove a SASL mechanic from the list to be used.
*
* @ Param mech the SASL mechanic to be removed
*/
Public static void removeSaslMech (String mech ){
If (defamemechs. 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 );
}
}
Use an array or pointer as a function parameter to delete non-lowercase letters in the string. In the main function, input strings and output the strings before and after the characters are deleted.
# Include <stdio. h>
# Include <ctype. h>
Void DeleteLower (char acstr [], int iCount)
{
Int iTemp = 0;
Char acTemp [30] = {0 };
Printf ("your input string: % s \ n", acstr );
For (int I = 0; I <iCount; ++ I)
{
If (! (Islower (acstr [I])
{
AcTemp [iTemp] = acstr [I];
ITemp ++;
}
}
Printf ("deleted string: % s \ n", acTemp );
}
Void main ()
{
Printf ("enter a string (less than 30) \ n ");
Char acstr [30] = {0 };
Scanf ("% s", acstr );
DeleteLower (acstr, 30 );
}
How to delete a character from a string in the C character array
For example:
# 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;
}
// I hope the landlord can understand that I have directly typed the code above. I don't know if the code can be compiled. Sorry, no compiler (in Internet cafes)