Tech Blogs
  • Vivek bhargav
  • Books
    • Seven Databases In Seven Weeks
      • Factors to consider
      • Genres of databases
      • Important questions
      • PostGreSQL
  • Tech
    • C++
      • Utils
      • Math
      • String
      • Vector
      • Set
      • Unordered Set
      • Map
      • Unordered Map
      • Queue
      • Priority Queue
      • Union find
      • Binary Search
      • Graph Algorithms
      • Matrix to Graph
      • Trie
      • Dijkstra
    • Database Transactions
      • A Simple Transaction Analysis
      • Implementation of Isolation Levels
      • Isolation Levels
      • Isolation
      • Storage Types
      • Transaction Atomicity and Durability
    • Java
      • Important Questions
      • Spring MVC
    • Program execution
      • Node.js
      • Runtimes
    • System Design
      • Basic Terminologies
      • CAP Theorem
      • Normalization of Database
      • Useful Reads
  • Personal Finance
    • Asset Classes
      • Equity instruments
      • Debt instruments
Powered by GitBook
On this page
  1. Tech
  2. C++

String

#include <string>                // Include string (std namespace)

string s;                        // Create strings

s = "hello";                     // assign

s.size();                        // number of characters in string
        
s[0];                            // 'h'

s.substr(m, n);                  // Substring of size n starting at s[m]

s = to_string(12.05);            // Converts number to string

reverse(s.begin(), s.end());     // reverse a string
PreviousMathNextVector

Last updated 13 days ago