Skip to content

Latest commit

 

History

History
49 lines (33 loc) · 941 Bytes

File metadata and controls

49 lines (33 loc) · 941 Bytes

{{< Draft >}}

Split String

You a string literal that you want to split into 2 string literals.

"This string has 2 parts"

Becomes:

"This string has "+"2 parts"

Recipe

1. Add std::string() to beginning if needed

Copy/paste the following before the string

std::string() +

The code should now look like:

std::string() + "This string has 2 parts"

Notes: this step might not be needed if you are already have a std::string object being concatenated to the string already. You can test this by skipping this step.

Proof: The code should compile

Notes: the only other way the code will compile after pasting this is if you paste into a comment or between an existing string

"std::string() + sometext";

2. Add Seperator

Now copy/paste the following into the middle of the string where you want to split it

"+"

Proof: The code should compile