View Full Version : c&p and what is the last char of a string

10-08-2007, 08:40 PM
I'm looking for three things (well, you could say two I guess).
I'm working in the C++.NET (2005) environment, and I want to make a onclick function that will copy the string from a text box (stores it in windows clipboard or w/e so it can be used through other programs) and one that pastes what's in the clip board into a textbox.

I'm also looking for something to check if the last character of a string is '.', and no I don't want to end up just using arrays instead of using strings.

Any ideas?
Thanks for future help and replies.

ralph l mayo
10-08-2007, 10:40 PM
I don't know how to work with the windows clipboard but the last character of a std::string called foo is == *(foo.end() - 1)

10-09-2007, 03:13 AM
oh I guess I forgot to mention, I'm using a System::String. I don't know what the difference is, but my teacher says to always use that in .NET because of "managed code" or something like that. I'm kind of new to .NET, but I do see a stringvar->EndsWith() in the {intellisense list?}, I'm not sure if that's the same thing or not, but I'll give it a try.

Yep, EndsWith works just fine. Thanks.
Now I need to know how to make a copy and a paste function for my windows form app's menu.