Login or Sign Up
Logging in...
Remember me
Log in
Or
Sign Up
Forgot password or user name?
Log in with
Search in titles only
Search in C Sharp only
Search
Advanced Search
Forums
Product Launch
Updates
Today's Posts
Member List
Calendar
Home
Forum
Topic
C Sharp
Remove chars from string
Collapse
X
Collapse
Posts
Latest Activity
Photos
Page
of
1
Filter
Time
All Time
Today
Last Week
Last Month
Show
All
Discussions only
Photos only
Videos only
Links only
Polls only
Events only
Filtered by:
Clear All
new posts
Previous
template
Next
ventsislav
New Member
Join Date:
Mar 2009
Posts:
16
#1
Remove chars from string
Apr 23 '09, 08:41 AM
Hi! I have str = "abv, ". How can I remove the comma and th space at the end faster?
kunal pawar
Contributor
Join Date:
Oct 2007
Posts:
297
#2
Apr 23 '09, 11:06 AM
This function used to remove char from string Or you can use Trim function.
string boject.Replace( old char,new char);
Comment
Post
Cancel
PRR
Recognized Expert
Contributor
Join Date:
Dec 2007
Posts:
750
#3
Apr 23 '09, 01:25 PM
Regular Expression
are good alternative to String.Replace for large strings...
Comment
Post
Cancel
ventsislav
New Member
Join Date:
Mar 2009
Posts:
16
#4
Apr 23 '09, 03:19 PM
I did it like this: str = str.Remove(str. Length - 2, 2);
Comment
Post
Cancel
Plater
Recognized Expert
Expert
Join Date:
Apr 2007
Posts:
7872
#5
Apr 23 '09, 04:04 PM
Originally posted by
ventsislav
I did it like this: str = str.Remove(str. Length - 2, 2);
Are you sure there will always only be 2 characters at the end that you don't want?
Comment
Post
Cancel
ventsislav
New Member
Join Date:
Mar 2009
Posts:
16
#6
Apr 24 '09, 05:59 AM
Yes, I know exactly what' s the string like, and that the last 2 chars are needless. But yet thanks!
Comment
Post
Cancel
Previous
template
Next
Working...
Yes
No
OK
OK
Cancel
👍
👎
☕
Comment