Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Part of A string

In VB there is a Statment like this:
Left("String",2) it will return "ng"
is there anything like this in C++?
[122 byte] By [Code_Writer] at [2007-11-11 8:10:11]
# 1 Re: Part of A string
i got it :)

RightStr("Programmer", 7)

returns the string

"grammer"
Code_Writer at 2007-11-11 21:01:31 >
# 2 Re: Part of A string
RightStr is not part of standard C++. Also, it isn't clear what string means in your code: a char array or a string object? Anyway, in the fomer case you simply use strstr() or count characters from offset 0. In the case of a string object you use specialized algorithms or iterators.
Danny at 2007-11-11 21:02:32 >