Skip to main content

Questions tagged [string]

A string is a finite sequence of symbols, commonly used for text, though sometimes for arbitrary data.

0 votes
1 answer
30 views

Replace every second letter with an underscore and return the result as a string

A challenge question "Given is a string hangmanString. Replace every second letter with an underscore and return the result as a string. The first character must be an underscore.". My ...
terry ikporo's user avatar
3 votes
1 answer
43 views

R: Efficient way to str_replace_all without recursively replacing conflicting substitutions?

Update: Elegant solution discovered Embarrassingly, I discovered a pretty elegant solution to the original problem shortly after posting it. I wonder why this didn't pop up in my initial googling... ...
rinkjames's user avatar
-1 votes
1 answer
55 views

I can't reproduce input embedded in a contest interface

I solved a contest task but couldn't submit it because I can't reproduce input embedded in the contest interface. Input is defined in 4 strings, each can be empty but has at its end a symbol for line ...
TiimeIrre's user avatar
  • 171
1 vote
2 answers
95 views

Difference between a mutable and immutable string [duplicate]

I just started studying C++, but there is a thing that I don't fully understand: when you initialize a std::string variable with a string literal, like this: std::string str = "some string"; ...
Gilberto Silva's user avatar
0 votes
1 answer
33 views

Is there a way to obtain a list separated by comma as the output of str_extract_all instead of the default output in R?

I have searched high and low and nobody seems to have asked that exact question, so I'm at loss. I have a data frame with a couple columns. One of this column contains various sentences that don't ...
Laue28's user avatar
  • 1
-4 votes
0 answers
42 views

What is wrong in this code that i have written for a leetcode problem [closed]

class Solution { public int lengthOfLastWord(String s) { for(int i=s.length()-1; i>=0; i--) { if(s.charAt(i) == ' '){ } else { l++; ...
ALZATO FF's user avatar
0 votes
2 answers
76 views

How to change the value of char in C++

Hi I'm completely new to C++. I have an assignment that is asking us to "Change the value to 97". The first part of the task is to make a character and give it the value 'a'. Then print ...
wtfamidoing's user avatar
-8 votes
0 answers
27 views

How to get and sort a string from an array in javascript? [closed]

I have this array with this string: ['MEX-CUN'] ['MEX-MTY'] and I would like a result similar to this: CUNMEX MEXMTY Is it possible to perform this action?
dany952's user avatar
  • 303
0 votes
0 answers
14 views

How do I find a word in a string in Pinescript?

I am trying to use the following code and it is saying "Could not find function or function reference 'str.contains". r= "RSI", cond = str.contains(divergence_text_bottom,r) Thanks ...
OnePlusTwo's user avatar
0 votes
0 answers
15 views

Keeping leading zeros for an int

I am using a Rigol DG 4162 waveform generator, and i want to extract data from it. I am using a USB to RJ45 Either network Adapter and python 3.11 to do this. The problem that I am running into is ...
Thomas Forsdyke's user avatar
1 vote
5 answers
84 views

String Manipulation based on Char Length in a dataframe

I wanted to do some string manipulation based on Char length condition. I have this table, let's called it sample table. RiskCode A01 A02.999 I want to transform the RiskCode column in sample ...
Dhestar Bagus Wirawan's user avatar
-4 votes
1 answer
57 views

Java String split by empty lines including empty lines at the end [closed]

I have seen many questions and answers online, but it seems that I cannot find the case that I have. String s = "a\nb\n\nc\n\n\n\n"; String[] split = s.split("\\R"); //is the same ...
Matjaz's user avatar
  • 484
-1 votes
2 answers
67 views

Searching for an Integer with the highest index within a string - C#

String[] digits = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" }; String line = "...
user26430853's user avatar
1 vote
2 answers
35 views

How to trim a string by the nth occurrence of a special character?

I have string values (filed name: filename) that follow a certain template: filename_this_is_called_Plan_A file_this_is_Plan_A filename2024_this_is_known_as_Plan_A While the strings are all a ...
user14452102's user avatar
0 votes
1 answer
60 views

Why is there random stuff in my string when printing its bytes?

I'm trying to see how format string bug works and tried to explore it by myself. This is a simple program: #include"stdio.h" #include"string.h" struct mystruct{ char buf[32]; ...
Mateusz's user avatar
  • 11

15 30 50 per page
1
2 3 4 5
12313