Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > beginer

Reply
Thread Tools

beginer

 
 
Darko Lapanje
Guest
Posts: n/a
 
      09-09-2003
how can I write program who removes all ' ' from the string?

dl


 
Reply With Quote
 
 
 
 
Alf P. Steinbach
Guest
Posts: n/a
 
      09-09-2003
On Tue, 9 Sep 2003 15:52:16 +0200, "Darko Lapanje" <(E-Mail Removed)> wrote:

>how can I write program who removes all ' ' from the string?


There are ways that for an experienced programmer would be easier,
but as a novice, translate to C++:


1) Obtain string s from e.g. program arguments or user, or
simply set it to a well-known test value like "steak brandy cigar".

2) Set string t to empty.

3) For each character position i in s, in ascending order:
{
Let c be character number i in s.
If c is different from a space, then
{
Append c to the end of t.
}
}


 
Reply With Quote
 
 
 
 
Russell Hanneken
Guest
Posts: n/a
 
      09-09-2003
"Darko Lapanje" <(E-Mail Removed)> wrote in message
news:bjkm2b$ocb$(E-Mail Removed)...
> how can I write program who removes all ' ' from the string?


There was actually a thread about this a couple of weeks ago:

http://tinyurl.com/mqge

Regards,

Russell Hanneken
http://www.velocityreviews.com/forums/(E-Mail Removed)


 
Reply With Quote
 
Stuart Golodetz
Guest
Posts: n/a
 
      09-09-2003
"Darko Lapanje" <(E-Mail Removed)> wrote in message
news:bjkm2b$ocb$(E-Mail Removed)...
> how can I write program who removes all ' ' from the string?
>
> dl


s.erase(std::remove_if(s.begin(), s.end(),
std::bind2nd(std::equal_to<char>(), ' ')), s.end());

HTH,

Stuart.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
beginer in ASP - how to implement counter Mario Krsnic ASP .Net 5 06-18-2006 01:14 PM
dummy beginer's question Lloyd Dupont ASP .Net 6 11-21-2005 05:42 PM
Beginer question ArMa Java 0 04-13-2005 08:45 AM
Simpler C++ Forum for beginer vee_kay C++ 7 01-29-2005 05:49 AM
Beginer need helppp!! My and I ASP .Net 1 08-24-2004 07:46 PM



Advertisments