Reputation: 17253
Does boost string have any methods that might assist me in returning a certain no of characters from a string if their position is specified. For instance something like
Left(std::string("Hello"),2)
might return "He". I checked the library page at here but could not find anyhing.
Upvotes: 0
Views: 52
Reputation: 126552
Just use std::string
's member function substr()
:
std::string("Hello").substr(0, 2);
Here is a live example.
Upvotes: 3