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

Simple Parse Question

Hi, what's a quick way to parse a string and remove everything after
the comma including the comma? I.e., if the string is "Hi, how are
you", I would want to just keep "Hi".

Thanks!

Jun 9 '07 #1
2 1069
Erik Lautier <la*****@gmail.comwrote in news:1181420726.492709.180390
@w5g2000hsg.googlegroups.com:
Hi, what's a quick way to parse a string and remove everything after
the comma including the comma? I.e., if the string is "Hi, how are
you", I would want to just keep "Hi".

Probably something like

MyString.SubString(0, MyString.IndexOf(",") - 1)

If you need more complex parsing, take a look at Regular expressions.
Jun 9 '07 #2
That's great, thank you - got rid of the -1 at the end but other than
that it does the job.

On Jun 9, 4:51 pm, Spam Catcher <spamhoney...@rogers.comwrote:
Erik Lautier <laut...@gmail.comwrote in news:1181420726.492709.180390
@w5g2000hsg.googlegroups.com:
Hi, what's a quick way to parse a string and remove everything after
the comma including the comma? I.e., if the string is "Hi, how are
you", I would want to just keep "Hi".

Probably something like

MyString.SubString(0, MyString.IndexOf(",") - 1)

If you need more complex parsing, take a look at Regular expressions.

Jun 9 '07 #3

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

Similar topics

7
by: gene.ellis | last post by:
Good morning. I am racking my brains over what seems like should be a simple question. I have a string that contains text and html. Basically, I would like to grab the HTML tags from the string and...
1
by: Proteus | last post by:
Any help appreciated on a small perl project I need to write for educator/teaching purposes. I have not programmed perl for some time, need to get up to speed, maybe some kind souls hrere will help...
14
by: Ian | last post by:
Hi I just started with C# and already i have a problem. i need to transalt this line from VB6 to C#. txtAnswer.text = (txtNumberOne.text - 32) * 5/6 Thanks
1
by: Brian Henry | last post by:
Hello, I was tring to learn socket's (being i never used them before) and have a simple question. I want to create a listner that will get any data recieved and print it out. I've been able to...
4
by: Wardeaux | last post by:
All, this XML is killing me... I'm new to XML, all I want to do is parse an XML string so that I can read the values... Mystr = "<A1><B1><C1>myC1</C1><C2>myC2</C2></B1><B2>myB2</B2><A1>" All...
2
by: dondraper | last post by:
I have an application that uses a popular but simple set of JavaScript routines that implement an AJAX call used to populate a drop-down. It works for thousands of user but I have one customer...
10
by: leaf | last post by:
How do i make a simple parser that parse strings ex. "string1 string2 string3" and store in a vector? how can it be done using BOOST.Spirit? --- leaf
0
by: Grzegorz Smith | last post by:
Hi All. I 'm learning ZSI to use SOAP and I desperately need help. I'm working on example from tutorial -(examples/server/send_response/ simple/wsdl/). Here are my wsdl files...
9
by: Pygmalion | last post by:
I have found dozen of useful PHP counters on the web. However, nobody is working for my web pages, since administrator does not want to enable the possibility that PHP could be called from HTML. ...
6
by: =?Utf-8?B?RWR3YXJk?= | last post by:
hi everybody, There is an error that drives me crazy and I can't figure out why VB.net behaves this way. I have a form and a textbox and the following code in the form Loads event Dim Ab As...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.