how to remove letters from string
public extractLetters(String str){
String result="";
for(int i= 0; i< str.length; i++){
if(Character.isLetter(str.charAt(i))){
result+=str.charAt(i);
}
}
how to remove letters from string
public extractLetters(String str){
String result="";
for(int i= 0; i< str.length; i++){
if(Character.isLetter(str.charAt(i))){
result+=str.charAt(i);
}
}
remove char from string
/* C Program to Remove All Occurrences of a Character in a String */
#include <stdio.h>
#include <string.h>
int main()
{
char str[100], ch;
int i, len, j;
printf("\n Please Enter any String : ");
gets(str);
printf("\n Please Enter the Character that you want to Remove : ");
scanf("%c", &ch);
len = strlen(str);
for(i = 0; i < len; i++)
{
if(str[i] == ch)
{
for(j = i; j < len; j++)
{
str[j] = str[j + 1];
}
len--;
i--;
}
}
printf("\n The Final String after Removing All Occurrences of '%c' = %s ", ch, str);
return 0;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us