Questions tagged [string]

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

0
votes
0answers
2 views

Powershell variable interpolation in command line arguments

Description I'm having some trouble with passing a JSON string correctly into a command. I believe that I have recreated the problem that I'm experiencing in the test believe. The JSON string uses ...
1
vote
0answers
9 views

Quotes not updating graphics draw string per quote

I've got an issue here where if I request a quote by clicking the small blue box, it doesn't want to update the numbers in the box every quote. This is what I use to draw the string into the box. ...
0
votes
2answers
34 views

Convert array of strings to array of objects in JSON property

I have the following JSON returned from an endpoint { "response": { "lines": [ "[{'line':'3007621h7s2','type':'national'},{'line':'3007663f7s9','type':'international'}]", ...
0
votes
2answers
19 views

Javascript + check if current URL is in external txt file

I have a txt file with some words in each line. I wish to have a small js file that does nothing else but check the current URL and if the URL contains any of the words from the txt file, then pops an ...
6
votes
4answers
138 views

Not able to replace the string containing $ in pandas column

I have a dataframe df = pd.DataFrame({'a':[1,2,3], 'b':[5, '12$sell', '1$sell']}) I want to replace $sell from column b. So I tried replace() method like below df['b'] = df['b'].str.replace("$sell"...
1
vote
3answers
41 views

Extracting element from a string

Im trying to extract a element between two HTML tags without any packages. Say I have a string: string <- c("<tb example", "<TEXT>", "some text", "<TEXT>", "<TEXT> some more ...
-1
votes
6answers
44 views

JavaScript break sentence at a given word

I'm having a situation where my data is coming from server side and I have to break the sentence into two lines, Example: Payment: xyz is done Removal: Refund made Now I have to make this sentence ...
-1
votes
0answers
18 views

How to handle Bold, Italic, underling text like whatsapp and jira does

I am doing feature like posting timelines In which use can change the font styles like BOLD,Ittalic,Underline . I am following the same way that jira and whats app do,more of I am following jira. ...
1
vote
2answers
33 views

php - preg_split() with multiple patterns not splitting quoted string

I need to split a paragraph into sentences. That's where i got a bit confused with the regex. I have already referred this question to which this Q is marked as a duplicate to. but the issue here is ...
-5
votes
2answers
40 views

how to sort a string alphabetically in c++ and it will also check the next after next alphbets in string [on hold]

I am taking 5 value from user Computer Keyboard Mouse CPU Mobile it will sort like Computer CPU Keyboard Mobile Mouse
-3
votes
0answers
36 views

conversion of ascii string character to int [on hold]

import java.util.Scanner; public class StringExample { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter any Character:"); ...
-5
votes
4answers
40 views

How to find a pattern in a string and separate it into two lists Python [on hold]

a = ""A" -> "apple"" How can i recognize the space/arrow/space so that i can slice the "A" into a string and the "apple" into another string ?
2
votes
4answers
76 views

Convert string to given regex pattern

How to convert the string into the given pattern. Consider pattern can be anything. Example: Input String is - 1234567890 For Pattern XXXX-XXXX-XX Then Output is - 1234-5678-90 For Pattern XXX-XXX-...
-1
votes
0answers
24 views

Swift: Convert string which contains number and mathematical functions to a number [duplicate]

Is there a way to convert this string: let equation = "sqrt(100)*2+5-(3+2)" to an equation respectively a number. So it results in 20 as an Int, Double or CGFloat?
0
votes
0answers
8 views

Strip a multiline strig just before and after format specifier

I have a string defined like this BODY_ISSUES = """\ <div style="background-color:LightSteelBlue"> <h1>Prog Execution Issues:</h1> <pre id="issues" style="outline:...
0
votes
1answer
18 views

How concatenate string and variable to a string in C [duplicate]

I need to concatenate a string and a variable to fill another string: #include <stdio.h> int main(){ char *te1; char *te2; char *tabela[2]; te1 = "text 1"; te2 = "text 2";...
-1
votes
0answers
12 views

C++: split a string and get all non-empty elements [duplicate]

Now I have a C++ string like this string str = " 1 30716 5 5 2 2 6"; I need to split the string and get all non-empty elements1,30716,5,5,2,2,...
6
votes
7answers
87 views

How to map the differences between two strings?

I came across the following question and was wondering what would be an elegant way to solve it. Let's say we have two strings: string1 = "I love to eat $(fruit)" string2 = "I love to eat apples" ...
-1
votes
0answers
16 views

Removing subsequent letters from a String without using str.contains() and str.replaceAll() [duplicate]

In Java, how can I remove subsequent letters from a String without using str.contains() and str.replaceAll()? Here is how I tried to do it and it hasn't been working: public static String delDel(...
0
votes
2answers
16 views

R partial string matching ignore spaces omni-directional

I am having issue with partial string matching. I have pairs of people, and I need to compare their names. To do this I have run a charmatch both directions on the two last names, to see if name1 is ...
1
vote
2answers
34 views

identify unique letters and corresponding count in input_string

input_string=mississippi output_dict={letters=[i,s,p,m],count=[4,4,2,1]} Remove duplicate entries from input_string and count those duplicate values and display in descending order. actual following ...
1
vote
0answers
29 views

Convert string obtained by str() function back to list [duplicate]

I am working with database that does not support json documents in relational tables. I am storing small lists like a=[1,2,3] as string b=str(a). As a result, I have b='[1, 2, 3]'. After fetching this ...
-1
votes
1answer
41 views

my ascii to binary converter that i wrote in C++ displays binary backwards, how can i make it display right?

Ok so I wrote a ascii to binary converter in C++, everything is great, the only issue is that it displays the binary backwards, I don't know how to go about and display it right. #include <...
1
vote
2answers
32 views

Script to extract strings between two strings in linux

I am trying to write a little script that will let me "org-capture" articles from my rss-reader (newsboat). So my scenario is this: I will pipe the article to a script; however, the article gets piped ...
-2
votes
2answers
28 views

awk - how to split the string found

I use this script to find two string recursively in my directory path. I need to split my string found using double occurences of':' as field separator. my string otput is something like this: ...
0
votes
0answers
12 views

Reversing a string in Python, what is wrong in two of my codes

1. a='kasturi' b=a[len(a)::-1] print(b) # gives irutsak 2. a='kasturi' for i in range(len(a)-1,-1,-1): print(a[i],end='') print(a) # gives irutsak In the Second code, for i in range(0,len(a)-1)...
-1
votes
0answers
53 views

How i return a string in a function cpp

I created a function that reads a JSON to set my screen in OpenCV, but when it returns a string, it gives the following error: In member function ‘std::__cxx11::string JsonControl::GetJson(std::...
5
votes
4answers
146 views

Function not returning desired string

#include <iostream> #include <string> using namespace std; string wordB(string input); int main() { //ask for word cout << "Enter a word\n"; //get word string ...
1
vote
1answer
33 views

Xcode JSON string to receive data

Im not sure if Im setting it up right, but I'm trying to receive data on an iPhone app from a server using a JSON string. I have created labels for the string but I don't receive the data. I know the ...
5
votes
4answers
109 views

How to check if an ArrayList of Strings contains substrings of another ArrayList of Strings?

List<String> actualList = Arrays.asList ("mother has chocolate", "father has dog"); List<String> expectedList = Arrays.asList ("mother", "father", "son", "daughter"); Is there a way to ...
-2
votes
1answer
37 views

What is the string format “%g%%” mean in python 3? [duplicate]

According to python 3 document, the string formating "%%" means "a perncet sign". Following code is an example: "%g%%" % 10.34 == "10.34%" I am not sure what does this "%g" mean here, I suspect it ...
0
votes
2answers
43 views

Unable to create two-dimensional array from a dynamic string

I am trying to load a dynamic string to an existing empty array(to create an array of array). The dynamic string looks like this (one, two, or more arrays of number separated by comma) $str = "[52,18,...
0
votes
1answer
37 views

Looping over a buffer received by a client program

newbie on C programming here searching for a little help! I have a buffer containing some data provided by a client program lets say something like this: pcity:Amsterdam gcity my problem is that ...
0
votes
0answers
10 views

shuffle an integer array and string array synchronized

No android studio experience what so ever, got the source code from a pro. I was wondering how to shuffle the String and int arrays synchronized. So there is this picture (imgapache_11) with the info ...
-2
votes
2answers
47 views

with SBT compile a Scala string cant be '${foo.bar}'?

I want a Scala string to be ${foo.bar} (literally, for testing some variable substitution later). I tried: val str = "${foo.bar}" val str = """${foo.bar}""" val str = "\${foo.bar}" val str = "$${foo....
0
votes
2answers
53 views

Best method to get substring after a given word in a String?

I have a long String, which is a json files contents. Somewhere in this String, it contains the following: "totalWinAmount":100 To find and return this value, I'm currently doing this: int ...
-1
votes
1answer
18 views

extract data from SharePoint document library to CSV using powershell

I am trying extract data of SharePoint document library to CSV file using powershell. I am getting data correct on CSv file. But one column i.e "Description" have more text data on it.So when run the ...
-2
votes
1answer
45 views

String seperation and combining

I have a challenge that I am trying to solve and cannot seem to come up with a solid solution. I have 3 records like this: "a,b,c,d,e","1,2,3,4,5","record 1" "f,g,h,i","11,12,15,16","record 2" "x,y,...
-1
votes
0answers
33 views

How to convert string to array based on characters difference using php? [duplicate]

I have a string and want to convert it to array that same character in side of each other putted in one item. For example $str = "aaaabbcccdee"; Should converted to: Array ( [0] => aaaa ...
1
vote
3answers
73 views

Method Reference for Integer type List

I have code like below. List<Integer> parameters = ... String string = " NOT IN (" + parameters.stream() .map(parameter -> parameter.toString()) .collect(...
0
votes
0answers
11 views

My code editor gets rid of _ when I type Japanese characters in between “ ” in YAML

My code editor gets rid of _ when I type Japanese characters in between " " in yaml. I use AWS cloud9 to write codes. For example, when I type current_password: "現在のパスワード"</p> this is ...
8
votes
4answers
385 views

How to trim multiple characters?

I have a string as follows const example = ' ( some string ()() here ) '; If I trim the string with example.trim() it will give me the output: ( some string ()() here ) But I want the output ...
0
votes
3answers
48 views

Split a String with Giving each Variable inside it a Value

I have this code which is supposed to Split and assign a value to each variable inside the String: string ab = "Seq [A=255, B=0, C=0, D=0]"; string[] abcd = ab.Split(','); int a = Convert.ToInt32(...
1
vote
2answers
45 views

How to replace dots, spaces and commas with hyphen and avoid double hyphen using php?

When I replace spaces, dots and commas of a string, it sometimes happens that I get double hyphens. For example turns check out the 1. place into check-out-the-1--place How can I avoid that? I want ...
3
votes
3answers
60 views

Check if string contains 10 digit number but space after each digit using php

Suppose $str = "hi hello 1 2 3 4 5 6 7 8 9 0 ok" so the match found. I have tried with regex like preg_match_all('/[0-9 ]{20}/', $str, $matches, PREG_OFFSET_CAPTURE); print_r($matches); but it ...
0
votes
0answers
12 views

[JAVA]Paste a String to the current position of my curser where clicked in by tiping a key on my Keyboard

Searching for a solution a while now, but don't find one. I would like to build a tool that allows me to paste texts into a text field if I press a key on my keyboard. E.g. when I'm writing emails. ...
0
votes
1answer
37 views

How to capture the string which is the output of print

Motivation: s = 诶 This is not an ASCII character, and we need to throw an error saying something like 'The string 诶 cannot be encoded using the encoding ASCII But if we do something like, raise ...
2
votes
5answers
73 views

Convert String representation of a List to a Dictionary Python

How can I convert a str representation of the list, such as the below string into a dictionary? a = '[100:0.345,123:0.34,145:0.86]' Expected output : {100:0.345,123:0.34,145:0.86} First tried to ...
0
votes
3answers
85 views

string created from variable in c#

Is it possible to to define a string from a variable where the string does NOT have quotations. Example: public class aclass { public string athing; } public void example(string thing) { ...
0
votes
2answers
64 views

std::string, const, and thread safety

This question has been discussed but I haven't seen a set answer yet. It's partially discussed here: https://www.justsoftwaresolutions.co.uk/cplusplus/const-and-thread-safety.html But the answer ...