Answers for "remove part of string"

10

removing a character from a string in c++

#include<iostream>
#include<algorithm>

using namespace std;
main() {
   string my_str = "ABAABACCABA";

   cout << "Initial string: " << my_str << endl;

   my_str.erase(remove(my_str.begin(), my_str.end(), 'A'), my_str.end()); //remove A from string
   cout << "Final string: " << my_str;
}
Posted by: Guest on October-15-2020
1

delete ending part of the string java

//To delete starting from "opened"
String str ="13 opened by someone";

String result = str.substring(0,str.lastIndexOf(" opened"));
Posted by: Guest on January-19-2021
1

remove part of string python

txt = 'abbacabbd'
print(url.replace('bbd',''))

#output:
abbaca
Posted by: Guest on July-16-2020
1

remove a part of a string python

import re
url = 'abcdc.com'
url = re.sub('\.com$', '', url)
Posted by: Guest on July-20-2020
0

how to remove voules out of a string

import java.util.Scanner;
public class RemoveVowelsUsingMethod
{
   static String removeVowel(String strVowel)
   {
      Character[] chVowels = {'a', 'e', 'i', 'o', 'u','A','E','I','O','U'};
      List<Character> li = Arrays.asList(chVowels);
      StringBuffer sb = new StringBuffer(strVowel);
      for(int a = 0; a < sb.length(); a++)
      {
         if(li.contains(sb.charAt(a)))
         {
            sb.replace(a, a + 1, "");
            a--;
         }
      }
      return sb.toString();
   }
   public static void main(String[] args)
   {
      String strInput = "Flower Brackets";
      System.out.println(removeVowel(strInput));
   }
}
Posted by: Guest on October-09-2020

Code answers related to "remove part of string"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language