string str = "Hello" ;
2. Write an expression that results in a string consisting of the third through tenth characters of the string s .
s . substr ( 2 , 8 )
3. Write a sequence of statements that finds the first comma in the string line , and assigns to the variable clause the portion of line up to, but not including the comma. You may assume that an int variable pos , as well as the variables line and clause , have already been declared.
pos = line . find ( "," ) ; clause = line . substr ( 0 , pos ) ;
No comments:
Post a Comment