Questions tagged [string]

68292 questions
1

votes
1

answer
1.1k

Views

How to reverse search in Excel?

I have a text in a worksheet like: The girl is very beautiful I want a formula to perform a search from right to left for the word 'very', and if found then extract it to some other region of the sheet. Note: Purpose of doing reverse search is because I want to implement it in my workbook which re...
Chen Guo
1

votes
2

answer
34

Views

how can I find the index for each time a char appears in a string (Javascript)?

Hi I'm trying to identify the index of a specific char for every time it is located in a string as well as providing the number of times it is detected. One way I thought of it was basically using finding the number of times it is in a string using (str.replace(/[^char]/g, '').length) and then using...
Nero
1

votes
3

answer
40

Views

Split the string array

I know this question was absolutely answered but i did not find solution. I get response from web-service a Json string response that is ['11,22222','33,44444']. I try this but did not work because string include these characters [ ] and first comma is in the here 11,22 StringBuilder result = new St...
1

votes
1

answer
70

Views

looping a string inside replace() method in JavaScript

I have two strings, the second string, as being converted from an array, containing NaN objects. I try to replace each NaN with a character from the first string, using replace() method. Although looping through a string goes well in a separated function, when I insert it as a second argument to the...
user2751869
1

votes
3

answer
503

Views

How to build connection string from existing connection for new database created dynamically?

I have query to dynamically create database. private void ExecuteNonQuery(string sql) { using (var connection = new SqlConnection(_connectionString)) { connection.Open(); SqlCommand command = connection.CreateCommand(); command.CommandText = sql; command.ExecuteNonQuery(); } } private void CreateDat...
Sachin
1

votes
2

answer
34

Views

Cut String out of String / 3 Parts

I wan't to cut my string like this a = 'dog [hidden] cat [/hidden] fox' $1 = 'dog '; $2 = ' fox'; $hidden = ' cat '; Im looking for a smooth way to do it! Thank you guys!
Duk
1

votes
3

answer
50

Views

Comparison between a string and an element of an array of strings

Part of my code: int t,w; String day; String[] week=new String[]{'mon','tues','wed','thurs','fri','sat','sun'}; . . . day=sc.nextLine(); . . for(i=0;i
Ankush Pandit
1

votes
0

answer
104

Views

emplace_back different definitions

I'm using emplace_back function in a cpp project in visual studio and it works correctly. Visual studio shows following definition for it: void std::vector::emplace_back(CHAR(&_Val)[1]) Then, I'm going to move my cpp project files to a MFC project and use them in a dialog based app. When I moved c...
Mahdi
1

votes
0

answer
98

Views

Best method for Edit Distance and LCS algorithms

I'm writing a monografie for college about optimizations in Edit Distance and LCS algorithms. Searching the internet I found two optimizations The four Russians method and Ukkonen Algorithm. I have to test it with this SPOJ problem (which requires a better Big O than O(NM) or O(N^2)). My question i...
Genarito
1

votes
1

answer
183

Views

Separating String on invisible character (tab, carriage return, group separator, etc)?

I am trying to split a String in an Android app on certain characters. The characters are pound sign, comma, semicolon, tab, carriage return, group separator, unit separator, and record separator. Here's how I'm doing the splitting: private ArrayList splitdata(String data, String delimiter){ ArrayLi...
person
1

votes
1

answer
482

Views

TypeError: '<' not supported between instances of 'NoneType' and 'str' using Pyner for Name entity recognition

I am trying to pass an email string to Pyner to pull out all the entities into a dictionary. I can verify my setup works with this returning two PERSON entities import ner tagger = ner.SocketNER(port=9191, output_format='slashTags') t = 'My daughter Sophia goes to the university of California. Jame...
PeachyDinosaur
1

votes
1

answer
56

Views

receiving an input string and return a list of sub-strings and the number of occurrences of each sub-string

I need to write an algorithm \ program that received only single output (string) and return all the possible substrings and the number of occurrences of each substring. I managed to do so, using 2 for loops, and complexity time of O(N^2). My Question is - Is there more efficient way to do so with lo...
Zlil Korman
1

votes
1

answer
64

Views

pass string to server side with ajax in tapestry

${message:setname} @OnEvent(value = 'valueChangedSetName') protected void onValueChangedSetName(@RequestParameter(value = 'param', allowBlank = true) String setName) { TransferOrder to = baskets.getTransferOrder(); this.setName = setName; to.setComment('Rename from ' + this.setName + ' to ' + setNa...
Yupp
1

votes
0

answer
41

Views

Rules of escaping characters in Android and ios strings

I'm wondering in strings.xml and localizable.strings, what are the treatments towards single(') and double(') quote and also line breaks. My understandings are: 1. string.xml needs all single and double quotes to be escaped. e.g. I\'m or \'story\' 2. localizable.strings only needs the double quotes...
Penny
1

votes
0

answer
39

Views

Reading a file with paragraphs in c

So I'm trying to read a text file with multiple lines of words and I would like to store in an array. I have tried this code: #include #include int main(){ FILE * fptr; char str1; fptr = fopen ('test1.txt', 'r'); printf('\n The content of the file is :\n'); str1 = fgetc(fptr); while (str1 != EOF)...
Danwoo
1

votes
2

answer
44

Views

how do I edit a character in string line with form input

My code is given below I am trying to change a character in the string line with a new form input is here. $text = '12345678910'; $mumu ='456'; if(isset($_POST['pch'])) { $change = $_POST['change']; $newtext = str_replace('$change','$mumu','$text'); echo $newtext; } echo ' Edit Number '; but...
wapob
1

votes
1

answer
48

Views

How do i have python3 search for a specific string in a text file

All I'm trying to do is have the program look for a specific string and if the file contains that string add to a variable and if not just print that it didn't work. But it keeps saying that the string was not found when i know it is in the file. for line in open('/home/cp/Desktop/config'): if 'Per...
lavarockman
1

votes
1

answer
55

Views

Javascript comparing alphanumeric strings

I have a collection of around 100 strings which have the following format and iterate up. aa-000-1 aa-000-7-8 aa-000-20-10 I'm attempting to do a comparison on these strings in order to categorise them based on information i'm provided with (I'm simply printing out the associated category at the mom...
user3120540
1

votes
2

answer
212

Views

How to get line from stdin and split it to tokens?

I am trying to write RPN calculator, but I've been struggling with getting arguments from user. What I want to do is: take whole line, split it to tokens and put it to array. I have something like below, but it works only once. On the second while-loop performing line is taken, but arr==NULL #inclu...
moorzyn
1

votes
1

answer
46

Views

Bash: Appending different strings to specific lines in a file

let's say I have a file that looks like this: The Way Direct 5.0 0.0 3.0 2.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 2.0 3.0 4.0 6.0 0.000 1.000 2.000 1.0 2.0 3.0 4.0 5.0 6.0 3.0 2.0 0.0 I'd like to change this such that it looks like this: The Way Direct 5.0 0.0 3.0 U 2.0 0.0 0.0 U 0.0 0.0 1.0 U 0.0 0.0 2.0 U...
J. P.
1

votes
2

answer
70

Views

Key Error in Python string with format call

The following code gives an error: filename='foo.txt' sed_str = 'PROJECT_DIR=\$\{PROJECT_DIR:-{}\}'.format(filename) print (sed_str) Results in: --------------------------------------------------------------------------- KeyError Traceback (most recent call last) in...
Ray Salemi
1

votes
0

answer
43

Views

How To Hide Strings Inside DLL File While Compiling?

I'm using the XorString class (with FORCEINLINE constructor) to hide strings like 'How are you?' but I can still see strings like c : \ u s e r s \ h a t t r i c k \ s o u r c e \ r e p o s \ h k . s k i n s \ d e p s \ j s o n \ s r c \ d e t a i l / s e r i a l i z e r . h p p even while they are...
Hattrick HKS
1

votes
0

answer
49

Views

Use Of Different Locale Values for Different Methods

When I use nextDouble() method of Scanner class like try (Scanner input = new Scanner(Paths.get('input.txt'))) { double d = input.nextDouble(); System.out.printf(Locale.getDefault(),'%.2f',d); } catch (NoSuchElementException | IllegalStateException | IOException e) { e.printStackTrace(); } nextDoubl...
Neophyte
1

votes
3

answer
263

Views

Partial match of strings [closed]

I would like to find a way to do a partial match of strings. I have two 50-bit binary inputs. If any input is matched with data at least 5-bit in database (array), I would print the input. Let's say my input is like this. X is a 'don't care' bit; it would be changed to ., 11XX110010001011011111011...
Jaeyoung Park
1

votes
1

answer
95

Views

Use string indices with colon (lua programming)

I am learning the lua programming from a online book. It talks about string indices for an array If the indices are strings, you can create a single index concatenating both indices with a character in between to separate them. For instance, you can index a matrix m with string indices s and t with...
Shuangjun Liu
1

votes
0

answer
155

Views

String similarity where order and difference in ascii code matters

Anybody aware of a string similarity method that would give the correct results for the below? I'm dealing with alphanumeric IDs where: a change in the early part of the string matters more than in the latter part. I guess I could do ngrams? Although that might break down in the scenario where one...
citynorman
1

votes
1

answer
38

Views

create column flag containing word from list

I want to add a flag to my python pandas dataframe, if an entry in the column contains the word from a list for any separete row we can use any(word in train['a'][0] for word in words) I tried to make a pattern import pandas as pd import numpy as np words=['photos','pictures', ' pics ', 'pix', 'ima...
Yury
1

votes
3

answer
108

Views

how to split a string with two or more pattern in php

I Want to split a String in php to Array that I have two or more separators in it. $string = '[Java , Android , Kotlin]'; I need : $mArray[0] = 'Java'; $mArray[1] = 'Android'; $mArray[2] = 'Kotlin'; but when I use $mArray = explode(',' , $string); it return me : $mArray[0] = '[Java'; $mArray[1] = '...
Ali Hajiloo
1

votes
2

answer
1k

Views

Check if string is balanced with brackets

I have to write Python supplementary function: def find(searched, open) for function which recursively checks if the input string has balanced brackets: def balanced (text): #.... return find(text, None)[1] I can't use stack. I have to include option, when input string is empty, when the bracket...
ljaniec
1

votes
2

answer
29

Views

How to modify the name of the class (variable instead of hardcoded) in Intent?

final Button voteYes = (Button) findViewById(R.id.voteYes); voteYes.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent successPhase = new Intent(player1.this, player5.class); startActivity(successPhase); } }); I have a integer variable that ranges from 1 t...
buzzerbeater27
1

votes
1

answer
209

Views

write lists to pandas dataframe to csv, read dataframe from csv and convert to lists again without having strings

Originally I had a list of list and each list contains tuples of strings (from some computations). I want to save them for later, so I don't have to do all the computations again and just read the csv. L = [l1,l2,...] l1 = [('a','b'), ('c','d'),...] l2 = [('e','f'), ('g','h'),...]... I converted it...
Philipp
1

votes
2

answer
134

Views

Replacing special characther in string with ampersand

I have a URL which basically looks like this: https://example.com/us/cgi-bin/webscr?cmd=_express-checkout\u0026token=EC-2BF46053LU471230V The URL is generated from a statement like following: if ((int)response.StatusCode == 200 || (int)response.StatusCode == 201) { var res = await content.ReadAsStri...
User987
1

votes
1

answer
98

Views

Mongoose / MongoDB query .find() any int > 0?

So I have a mongoose schema that looks like this. var info = new mongoose.Schema( { '123': { available: { type: 'String' }, onOrder: { type: 'String' } }, '456': { available: { type: 'String' }, onOrder: { type: 'String' } }, '789': { available: { type: 'String' }, onOrder: { type: 'String' } } });...
Echo
1

votes
0

answer
72

Views

How to split the String fast to get final result by Swift

I have a question of splite the String. And I try to write a function in playground and test it's runtime. I don't know whether have another better function of splite string or not. Have any idea to suggest me? Thanks. func spliteMessage() -> String { let startTime = CACurrentMediaTime() print('-->...
Beginnerrrrrr
1

votes
0

answer
157

Views

How to convert Z3 String Expression into Python String

I'm using Z3py and Strings to generate some new constraints from a recursive data type (list). In order to construct related constraints in Z3 engine, I used Z3 String to store it. For example, if we have a list (a,b,c), then we produce x1==1, x2==2, x3==3 by means of (a,b,c) in the engine. Then we...
Kun
1

votes
1

answer
66

Views

Why is my string capped at 32,758 characters when outputting to CSV?

I'm running a Python 2.7.12 program to process a lot of data and one of the strings I create stores a lot of data, but I have noticed that it is capped at 32,758 characters when I output the string as a CSV. I'm running my script on a development server on an Ubuntu-16.04 VM with access to 20GB of R...
SPYBUG96
1

votes
1

answer
121

Views

Concatenate immutable ruby strings with codepoints

Prior to Ruby 2.3, which introduced optional frozen strings, a string could be appended to using the shovel operator ('
Jason W
1

votes
1

answer
46

Views

scilab, how do I search for strings in matrix with exact match

how do I find an exact match of a string in a matrix with scilab. 'grep' does not give exact match. e.g. when I search for 'H2' it also shows 'H2O' Any ideas? Thanks!
FMK
1

votes
0

answer
13

Views

how to use scanner.in array with strings and pick a random string?

The goal is to draw a random name from a hat using a switch command String[] names = sc.next(); // how do I create an array of names with user input? also, see case a. case 'a': System.out.println('\nPlease enter the names of the participants.'); final String[] names = {sc.next()}; /*how do I add...
J bl
1

votes
1

answer
23

Views

In excel can anyone show me how to concatenate strings and variables to make a cell reference?

If I manually reference a cell in another spreadsheet (by typing = in the destination cell and then clicking in the source spreadsheet), excel creates a formula like this: ='H:\excel\data\[source_file.xls]Sheet1'!$C$5 I am wanting to create that formula from the cell and path which are stored in cel...
Mike Avison

View additional questions