C++ *string convert to string [closed] - c++

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I've seen a code and there was string* name. Isn't it wrong? I mean string name is already creating a vector of characters, what would there be string* ? Thank you!

It would be something like
string *xyz = new string (...)
which is a string pointer.
Can you please post the part of a code here of what you saw/made.

Related

Terminate a c++ string [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
Is there a way to terminate a C++ string at any arbitary location. This is very easy in C as we can just insert a null character wherever we want. But how can the same be achieved in C++ String.
For example, Let's consider the following example,
string str = "This is Stack OverflowXXXX";
Now I want to terminate this string so that I would get "This is Stack Overflow".
Yep! Use string::erase:
str.erase(k);
will erase all characters from position k forward. There's no way to "undo" this to get those characters back, though.
Hope this helps!

Regex expression String contains alpha bates and arithmetic operator - [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I need Regex expression it Start with alpha bates and it contains - symbol please help me
Example: One-Two-three
thanks
^[A-Za-z][A-Za-z-]*$
should do it

How can I match a pattern which is not containg any capital letter in Regular Expression? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have tried to match a string which is not contain any capital letter.But I don't Know how to do it. Can anyone help me.
Compare a lower cased version of the string to what the user entered. If they're equal, it's all in lowercase.

Check if CString contains specific Text MFC [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I want to check if a String contains a specific Text.
Something like this
CString a;
CString b;
if (a.Find (b))
{
String a contains String b
}
Can anyone help me? Im working with mfc
If you change your if statement to
if (a.Find (b) != -1)
then you get what you want.

What does a single colon introduce as part of a constructor? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
This is from a CPP Source File:
class classname{
//constructor
classname(anotherclass *ptr);
private:
string firstname;
string lastname;
};
classname::classname(anotherclass *ptr): firstname("Nathan"), lastname("Narcovy"){
//some other definitions
}
I come from C, but I do know a bit of Object Oriented Language,
But I don't understand classname:string,string . I only remember a colon : was used for inheritance.
This is actually how the initializer list works for constructor.
I've found this tutorial which seems to explain it decently for newcomer.