Hi all,
Does anyone have suggestion what can I do to remove some string from a string?
Like this :
Original : I have a cat.
Remove : have
Result : I a cat.
Thanks in advance.
10 60371
Hi all,
Does anyone have suggestion what can I do to remove some string from a string?
Like this :
Original : I have a cat.
Remove : have
Result : I a cat.
Thanks in advance.
The specs for the String class has the method you're looking for.
Hi all,
Does anyone have suggestion what can I do to remove some string from a string?
Like this :
Original : I have a cat.
Remove : have
Result : I a cat.
Thanks in advance.
Hi
There is a String class and some methods are associated with it. Read this class and their methods , your problem will be solved
There is a String class and some methods are associated with it. Read this class and their methods , your problem will be solved
The String class should solve the problem, providing you don't need anything exotic (like "delete all words that start with an 'h'"). But even then, you'll be able to use the given methods to solve the problem, it will be a bit more work though.
The String class should solve the problem, providing you don't need anything exotic (like "delete all words that start with an 'h'"). But even then, you'll be able to use the given methods to solve the problem, it will be a bit more work though.
Regular expressions
Regular expressions
Arg, didn't think of that. But at least I wasn't totally mistaken:
The package java.util.regex is only provided from java 1.4, some of it even from java 1.5 onwards, so for backwards compatibility... ^^ OK, hardly anyone uses something older than 1.5 these days, but you never know! :-D
Hi all,
Does anyone have suggestion what can I do to remove some string from a string?
Like this :
Original : I have a cat.
Remove : have
Result : I a cat.
Thanks in advance.
Hi,
following code will help u..
class Stringremoval
{
public static void main(String args[])
{
String sample="i have book";
StringBuffer s = new StringBuffer(sample);
StringBuffer AfterRemoval=s.delete(2,6);
System.out.println("removed part:"+removedpart);
}
}
-Thanks & Regards
Hamsa
Hi,
following code will help u..
class Stringremoval
{
public static void main(String args[])
{
String sample="i have book";
StringBuffer s = new StringBuffer(sample);
StringBuffer AfterRemoval=s.delete(2,6);
System.out.println("removed part:"+removedpart);
}
}
-Thanks & Regards
Hamsa
Spoiler: removing part of a String is identical to replacing that part of the String
by nothing, i.e. the empty String "". There's no need for all those statements
(what is "removedpart"?)
kind regards,
Jos
Hi,
I had found the code to replace sub string in string. The code can be like this : - String tmpString = myString.replace(textToReplace,"");
Thanks all.. :)
Spoiler: removing part of a String is identical to replacing that part of the String
by nothing, i.e. the empty String "". There's no need for all those statements
(what is "removedpart"?)
kind regards,
Jos
hi,
sry its not "removedpart" in tat pgm... its "Afterremoval" which is string...
wat u said also rite..(removing --replacing the string with"")
Hi,
I had found the code to replace sub string in string. The code can be like this : - String tmpString = myString.replace(textToReplace,"");
Thanks all.. :)
Great work. You'll often find that those doc pages usually have what you need.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: gipsy boy |
last post by:
// --
using namespace std;
map<string,string> formMap;
list<string> formParams;
for(list<string>::iterator fit = formParams.begin();
fit!=formParams.end(); fit++) {
cout << "key=" << *fit;...
|
by: soni29 |
last post by:
hi,
how can i remove a string from an existing string in javascript. i
have a textbox in a form and want to make sure that when the user
clicks a button that certain words are moved, like all...
|
by: herrcho |
last post by:
i'm in the course of learning C, and found these two words "string,
string literal" confusing me..
I'd like to know the difference between them.. Thank you
|
by: Martin Jørgensen |
last post by:
Hello again,
Sorry to bother but I guess my C++ book isn't very good since it
obviously contains errors so the program code doesn't work with g++.
However I don't understand what the problem...
|
by: Wilson |
last post by:
Hi,
How do get the Dictioanry object from FiedlInfo ?
my code :
fieldInfo = this.GetType().GetField("dictioanry1");
??Dictionary<string, string> dicTemp1 = (Dictionary<string,...
|
by: Steve Richter |
last post by:
KeyValuePair<string,stringhas a ToString method that returns the
KeyValue pair seperated by a comma and enclosed in :
Is this method used as a building block for serialization?
The reason I...
|
by: Andy B |
last post by:
I don't know if this is even working or not but here is the problem. I have
a gridview that I databound to a dictionary<string, stringcollection:
Contract StockContract = new Contract();...
|
by: Leigh Finch |
last post by:
Hey Guys,
Quick question about the PHP compiler, is there any performance
difference between
$string .= $new;
and
$string = $string . $new;
|
by: drjay1627 |
last post by:
I need help with inserting a string for both key and value to a map.
while(!myHuffFile.eof()){
string word, code;
int freq;
myHuffFile >> word >> freq >> code;
if(word == ""){...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: Aliciasmith |
last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: nia12 |
last post by:
Hi there,
I am very new to Access so apologies if any of this is obvious/not clear.
I am creating a data collection tool for health care employees to complete. It consists of a number of...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
|
by: SueHopson |
last post by:
Hi All,
I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...
| |