473,473 Members | 2,226 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Remove first word of a string

Hello,

I want to remove the first word of a string.

For example:

MyString = "Hello World! How are you?"

I need to create 2 string:
MyString1 = "Hello"
MyString2 = " World! How are you?"

I was able to get the first word but not to remove it from the original
string.
Could someone help me out?

Thanks,
Miguel

Oct 1 '06 #1
2 6123
is this a homework asignment ...?

use the split function on the space character
"shapper" <md*****@gmail.comwrote in message news:11**********************@m73g2000cwd.googlegr oups.com...
Hello,

I want to remove the first word of a string.

For example:

MyString = "Hello World! How are you?"

I need to create 2 string:
MyString1 = "Hello"
MyString2 = " World! How are you?"

I was able to get the first word but not to remove it from the original
string.
Could someone help me out?

Thanks,
Miguel

Oct 1 '06 #2
Assuming single-space is a word sep character, s.Remove (0, s.IndexOf ('
')+1) will get rid of the first word.

HTH.

"shapper" <md*****@gmail.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
Hello,

I want to remove the first word of a string.

For example:

MyString = "Hello World! How are you?"

I need to create 2 string:
MyString1 = "Hello"
MyString2 = " World! How are you?"

I was able to get the first word but not to remove it from the original
string.
Could someone help me out?

Thanks,
Miguel

Oct 1 '06 #3

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

Similar topics

12
by: Sam Collett | last post by:
How do I remove an item with a specified value from an array? i.e. array values 1,2,2,5,7,12,15,21 remove 2 from array would return 1,5,7,12,15,21 (12 and 21 are NOT removed, duplicates are...
8
by: Joseph | last post by:
I have a textBox that people writes stories in it. They can use for format. I have Aspell installed on the server, so people can make correction to their text. Sometimes, they forget to add a...
18
by: prasanna.hariharan | last post by:
Hi guys, I want to remove certain words from a c++ string. The list of words are in a file with each word in a new line. I tried using the std::transform, but it dint work. Anybody got a clue...
11
by: steve smith | last post by:
Hi I'm still having some problems getting my head round this language. A couple of things don't seem to work for me. First I am trying to obtan a count of the number of words in a sting, so am...
13
by: Pedro Graca | last post by:
I'm sure this isn't very pythonic; comments and advice appreciated def curious(text): """ Return the words in input text scrambled except for the first and last letter. """ new_text = "" word...
3
by: Niyazi | last post by:
Hi all, I have a dataTable that contains nearly 38400 rows. In the dataTable consist of 3 column. column 1 Name: MUHNO column 2 Name: HESNO Column 3 Name: BALANCE Let me give you some...
6
by: Tashfeen Bhimdi | last post by:
I'm trying to remove punctuation from a string with the following code: ---------------------------- #include <string> #include <algorithm> #include <cctype> .. using namespace std ..
3
by: shalini jain | last post by:
Hi all, I dont know much of PERL so i m facing a problem in trying to remove the variable length of word from the string. I have written a code for it. Please guide me whether i will get the...
2
by: whodgson | last post by:
The following code accepts a string from the user and swaps the first and last letters in each word. It prints out the original string incorrectly by dropping off the first letter of the first word....
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.