1 / 3
Jun 2010

hi all,
i want to know how to decrease a string
for example:

string x,y;
cin>>x;
//the size of this string is 5 --- i want to take the new string y from x with length 3 not its real length
//for example x is "asdfg"  so i want y to be "asd"

how ?:arrow:

  • created

    Jun '10
  • last reply

    Jun '10
  • 2

    replies

  • 108

    views

  • 2

    users

You're looking to create a substring. In c++ I believe it's called substr.

it will be slow If you have to do it quite a bit. I would question your requirements to be certain.