Switch to full style
C++ code examples
Post a reply

get string size in c++

Thu Nov 13, 2008 7:28 pm

Get the string size using C++
cpp code
#include <iostream>
#include <string> // include for C++ standard string class
using namespace std;
int main()
{
string stringA = "C++";
string stringB = "Is Cool";

cout << "Length of stringA = " << stringA.length() << endl;
cout << "Length of stringB = " << stringB.length() << endl;

return 0;
}

/*
Length of stringA = 3
Length of stringB = 7

*/




Post a reply
  Related Posts  to : get string size in c++
 Set image size as a percentage of the page size     -  
 recursive string reversal- reverse string     -  
 check if string ends with specific sub-string in php     -  
 check if string start with a specific sub-string in PHP     -  
 Splitting a String Based on a Found String     -  
 String token for string split     -  
 Nav button size     -  
 Array size to zero     -  
 What is the size of this Structure     -  
 set the size of border in pixels     -