Most efficient way of ignoring spacing on c++? [closed] - c++

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
If I have two strings:
string str1 = "Something about the way that you walked into my living room";
string str2 = "Something about the way that you walked into my living room";
How do I write a function to return that these two strings are the same thing?

Firstly, you can replace multiple consecutive spaces with single space as given here
Replace multiple spaces with one space in a string
Then compare the strings

Related

How do I write a Regex pattern to match the following strings? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have string that could come in several forms
“PSM000216556880035450088|TRF”
“VNM000216556880035450088|TRF FROM MACK”
“NXG000216556880035450088”
“Transfer from josh SL000216556880035450088 to jack”
“X00000216556880035450088 0098123 TRANSFER 789121”
I need a Regex pattern that could get the string that starts with PSM, VNM, NXG, SL00 or X00.
i.e. in 1, I need “PSM000216556880035450088”. This string is the reference and it is what I need. It can be found in any position in a sentence and sometimes the reference might not be separated from the other words by a space. Sometimes a special character can be used as a separator. i…e. in 2 “VNM000216556880035450088|TRF FROM MACK”.
I will be using the Regex in my VB.NET code.
What about this with multiline flag?
((?:PSM|VNM|NXG|(SL|X)00)\d+)

Split a string in UIPath using regex [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I have a string stored in a variable - "Input_value:123_Output".
I want to split this string with underscore(_) and Double colon(:). So that the indexing of my output string will be like this : [0]-Input, [1]-value, [2]-123, [3]-Output.
Thanks!
Try splitting on the regex character class [:-]. This would split on either a colon or an underscore, which is the behavior you want.
In addition to [:-] looking like a smiley face, it is also very compact and easy to read.

C++ String individual characters [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I'm trying to make a function that takes the first and last letters of a string, divides them for the modulus and stores them in an array spot related to the modulus number. However I don't know how I would get the first and last letters of the string.
Assuming std::string str, you can use either:
str.front() and str.back() (C++11 and later only).
str[0] and str[str.size()-1], if str is not empty.
You can have the first letter of your string by just using yourString[0] and to get the last latter you can use yourString[yourString.size()-1]
EDIT
As said in the comments, assuming you're using std::string

How can I store a whole word in to a single array slot? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I wanted to ask how can I store a whole word in to a single array slot?
What I want to do is to somehow make this or something similar to this work so that i could access a whole word just in one slot of an array:
string words;
words[0] = "First";
words[1] = "Second";
If you want words to be an array then make it an array
string words[2];
words[0] = "First";
words[1] = "Second";

How to get variables to my program vrom text file [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have a file like:
a [able%5:00:00:capable:00] [able] capable
a [abnormal%3:00:00::] [abnormal]
a [absent%3:00:00::] [absent]
a [absolute%3:00:00::] [absolute] perfect or complete
a [abstract%3:00:00::] [abstract] existing only in the mind
a [abundant%3:00:00::] [abundant] plentiful
I want to get first column "avle", "abnormal" etc to my object. How to crop them and how storage them?
Use the string tokenizer, the best/easiest way to split a line into different variables.
char* word = strtok(line," [%:]");
char* word2 = strtok(0," [%:]");
int value = strtoi(strtok(0," [%:]"));
to store there is a vector container, but there can be used any type of arrays, what is more convenient