473,327 Members | 2,025 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,327 software developers and data experts.

Remove chars from string

Hi! I have str = "abv, ". How can I remove the comma and th space at the end faster?
Apr 23 '09 #1
5 2848
kunal pawar
297 100+
This function used to remove char from string Or you can use Trim function.
string boject.Replace(old char,new char);
Apr 23 '09 #2
PRR
750 Expert 512MB
Regular Expression are good alternative to String.Replace for large strings...
Apr 23 '09 #3
I did it like this: str = str.Remove(str.Length - 2, 2);
Apr 23 '09 #4
Plater
7,872 Expert 4TB
@ventsislav
Are you sure there will always only be 2 characters at the end that you don't want?
Apr 23 '09 #5
Yes, I know exactly what' s the string like, and that the last 2 chars are needless. But yet thanks!
Apr 24 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: chris | last post by:
is there a quick and easy way to check a string for non numeric characters ? i have thought of making a routine to check each character to confirm it is 0 - 9 but was wondering if there was a...
3
by: Don Hiatt | last post by:
Greetings, Is there an easy way to remove multiple non-printable (e.g. "not strings.printable") from a string? Perhaps something like foo.replace(list_of_nonprintables, '') if it only existed?...
9
by: Durgesh Sharma | last post by:
Hi All, Pleas help me .I am a starter as far as C Language is concerned . How can i Right Trim all the white spaces of a very long (2000 chars) Charecter string ( from the Right Side ) ? or how...
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...
4
by: Alfons | last post by:
Hi, How can I convert an array of chars into a string and vice versa ? char myChars = new char; I want to convert these 10 chars into a single string, but how ?
6
by: guy | last post by:
if a string contains surrogate chars (i.e. Unicode characters that consiste of more than 1 char) do functions that use an indexer or a string length into the string e.g. Mid, Len work correctly? ...
3
by: Li Pang | last post by:
Hi, I want to know the easiest way to remove the last line in a text file, or how to catch the last line of a text file. Thanks in advance
10
by: Mike Copeland | last post by:
I have data I need to normalize - it's "name" data. For example, I have the following: "Watts, J.C." I wish to (1) parse the "first name" ("J.C.") and adjust it to "JC". Essentially, I want to...
26
by: Brad | last post by:
I'm writing a function to remove certain characters from strings. For example, I often get strings with commas... they look like this: "12,384" I'd like to take that string, remove the comma...
19
by: imLVcrazy | last post by:
Hi Does any1 know of a method where you can search through a string and remove chars from a specific pointer until the new line. For example: "This is a test @ A test this is" how do make it...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.