All Questions
219
questions
0
votes
1
answer
42
views
How to getline from txt file and check if it is correct with what the user inputed
I am creating a bank application.
So far, I can create an account. After that, it encrypts the data like password and SSN. After that, it takes me to the login function where I have to enter my user ...
0
votes
1
answer
42
views
Reading the values out of an expression string, while keeping the formula intact
I have some code with mathematical operations, and I'm trying to make them easier to read and debug. But a very particular case is becoming complex, here's an example:
public int val1=1;
public int ...
-3
votes
1
answer
77
views
Could you please explain below three codes?, why they are giving different results
code 1
list_a = []
list_a += str(1)
O/P:
['1']
code 2
list_a = []
list_a += 1
O/P:
Type Error
code 3
list_a = []
list_a = list_a + str(1)
O/P:
Type Error
I'm expecting that if += operator ...
0
votes
0
answers
24
views
String variable as operator [duplicate]
I'd like to know if I can store operator (==,~=,> and so) in a string variable ad use like this
local a, b, op = 1, 2, ">"
if b op a then print("print something") end
0
votes
0
answers
57
views
Working with operators from string in JS without 'eval()' or 'new Function()' [duplicate]
I got an assignment where a DB has operator conditions (===, <, >, * etc) to use with some accompanying data.
I need to run those conditions in my JavaScript code.
What I found around here is ...
0
votes
1
answer
58
views
Temporary string comparison with > and < operators in C++ [duplicate]
These operators do not perform lexicographical comparisons and seem to provide inconsistent results.
#include <iostream>
int main () {
std::cout << ("70" < "60") ...
1
vote
1
answer
110
views
How to overload the add operator to return the length of two string when they are added?
I am trying to create a class diffStr that behaves like str except, when a user tries to add or multiply two strings, the output is the length of each string added or multiplied (respectively).
My ...
1
vote
1
answer
15
views
How to divide numbers from a string into two lists according to what operator(+ or -) preceds them?
string = "6+324-909+5+55-1"
listPositive = []
listNegative = []
I would like to put numbers with "+" in front of them in listPositive and numbers with "-" in front of ...
0
votes
3
answers
77
views
What does the % inside a string do in Python? [duplicate]
def leakyPipes(n):
if (n > 0):
if (n % 4 == 0):
print("drip %d" % n)
leakyPipes(n-3)
if (n % 3 == 0):
print("drop %d" % n)
leakyPipes(12)
What ...
0
votes
1
answer
47
views
Two equivalent strings show as Unequal in React
I have two identical strings (I literally copied and pasted string1 and just changed the name to string2). They are interpreted as unequal:
import "./styles.css";
export default function ...
1
vote
0
answers
202
views
no match for 'operator+' in basic_string <char> and uchar
I'm trying to create a concatenated string using a basic_string<char> and a uchar* (unsigned char*). I'm running into issues and have tried every method possible.
My code looks like this at the ...
0
votes
0
answers
14
views
How to add or subtract in heredoc syntax? [duplicate]
I need the following setup:
<ul>
<li>8</li>
<li class="active">9</li>
<li>10</li>
</ul>
I am trying to do this with php heredoc:
$pos =...
1
vote
0
answers
23
views
Is there a (language-agnostic) name for the string operators such as $=, ^= found in e.g. CSS?
There is a set of operators, used e.g. in CSS attribute selectors or in youtube-dl's format selection syntax, that are similar to the more conventional relational operators such as == but select the ...
-1
votes
1
answer
67
views
Why can I pass a String and a StringBuilder references to the '+' opereator, but not other objects
I have a Person object.If I try to pass this object along with a reference to an Integer wrapper class to the '+' operator, I get an error because they arent of the same dataype. But if I have a ...
0
votes
0
answers
41
views
Why "51" > "6" is false (String > String) in JavaScript [duplicate]
Why "51" > "6" is false in JavaScript
"51" > "1" = true
"51" > "2" = true
"51" > "3" = true
"51" &...