V
V
Void Vasher2015-05-26 18:04:28
Python
Void Vasher, 2015-05-26 18:04:28

Python feature in C++?

I would like to know if there is in C ++, an analogue of a feature that is organized in Python. I'm not interested in any function, but a syntactic feature.

# допустим, есть у нас некая строка. 
someString = "String"

# мне нужно вернуть ее, без первого символа. В Python сделать это - easy, но как с этим в C++?
print someString[1:5]

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
dordzhiev, 2015-05-26
@AlgollY

www.cplusplus.com/reference/string/string/substr

V
Vladimir Martyanov, 2015-05-26
@vilgeforce

charstr[]="string";
printf("%s", &str[1]); - for example, this way you can pass a pointer to a string, starting not from zero, but from its first character.

V
Valentine, 2015-05-26
@vvpoloskin

No, this construction contradicts the syntax of the language. Only through a function or method.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question