473,378 Members | 1,377 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Re: 'string'.strip(chars)-like function that removes from the middle?

Ethan Furman wrote:
Greetings.

The strip() method of strings works from both ends towards the middle.
Is there a simple, built-in way to remove several characters from a
string no matter their location? (besides .replace() ;)

For example:
.strip --'www.example.com'.strip('cmowz.')
'example'
.??? ----- 'www.example.com'.strip('cmowz.')
'exaple'
Thanks for all the ideas!
--
Ethan
Jun 27 '08 #1
0 634

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Marcio Kleemann | last post by:
I need to force the first letter of each word in a line of text to uppercase. The text comes from a TextBox control in a Web Form. I'm new to ..NET and am having a problem. Since I can't modify...
0
by: William Stacey [MVP] | last post by:
Had a method that got some string info from mp3 tags in N files and serializes this class and deserializes at other side. Works ok except sometimes get chars that choke the XmlSerializer. After...
8
by: Nikolay Petrov | last post by:
I need a way to strip chars from a string. The chars are all chars that are not allowed in file path. TIA
7
by: orangeDinosaur | last post by:
Hello, I am encountering a behavior I can think of reason for. Sometimes, when I use the .strip module for strings, it takes away more than what I've specified. For example: >>> a = ' ...
10
by: Niklas Engfelt | last post by:
Does anyone have a nice algorithm/method to increase all digits one step, e.g. 123123 to 234234 and 4444 to 5555 and 999999 to 000000? Best regards Niklas
33
by: sklett | last post by:
I need to take a string, make the first character lowercase and prepend an underscore character to it. Something like this: "California" "_california" Here is the (ugly) solution I cam up...
9
by: Mosquito Man | last post by:
string s("0101"); I can't change it into s=1101 by s='1'; because string.this is read-only, no assignment is allowed :-( thank you for your help
2
by: tcomer | last post by:
Hello. I'm working on a client/server application and I'm having some weird issues with concatenating strings. The client program sends some text: Object objData = "IssuedCommand:SenderName";...
1
by: O.B. | last post by:
In the example below, I'm trying to convert a fixed byte array to a string. I get an error about needing to use "fixed" but I have no clue where to apply it. Help? using System; using...
3
by: Colin J. Williams | last post by:
The Library Reference has strip( ) Return a copy of the string with the leading and trailing characters removed. The chars argument is a string specifying the set of characters to be removed....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.