string

python: how many similar words in string?

i have ugly strings that looks like this: string1 = 'Fantini, Rauch, C.Straus, Priuli, Bertali: 'Festival Mass at the Imperial Court of Vienna, 1648' (Yorkshire Bach Choir & Baroque Soloists + Baroque Brass of London/Seymour)' string2 = 'Vinci, Leonardo {c.1690-1730}: Arias from Semiramide Riconosciuta, Didone Abbandonata, La Cad...

How to find a static String in a Interface

I have the folowing interface; public static interface Attributes { public final static String InterestDeterminationDate = "InterestDeterminationDate"; public final static String CreditType = "CreditType"; public final static String NumberInternal = "NumberInternal"; public final static String InterestRat...

How to enter quotes in a String?

I want to initialize a String in Java, but that string needs to include quotes; for example: "ROM" I tried doing String value = " "ROM" ";, but that doesn't work. How can I include "s within a string? ...

Convert String to Int Objective-C?

Hello! Really basic iPhone Objective-C question. I'm trying to extract a string (which is really a int) from an array and then use it as an int in a function. I'm trying to convert it to a int using intValue. Here's the code I've been trying. NSArray *_returnedArguments = [serverOutput componentsSeparatedByString:@":"]; [_appDeleg...

How to delete a character from a string using python?

This is for a friend and we are brand new to Python. There is a string, for example EXAMPLE How can I remove the middle character i.e. M from it. I don't need the code, what I want to know is Do strings in python end in any special character? Which is a better way - shifting everything right to left starting from the middle character...

C++ concatenate string problem

Why does the following code not work? #include <iostream> #include <string> int main(){ char filename[20]; cout << "Type in the filename: "; cin >> filename; strcat(filename, '.txt'); cout << filename; } It should concatenate ".txt" on the end of whatever filename is inputted Also, when I try to compile it (with g...

Understanding CComBSTR assignment operators

Say I have the following: BSTR myBSTR = SysAllocString( L"MYBSTR" ); CComBSTR myCComBSTR = myBSTR; Does myCComBSTR take ownership of myBSTR and free it when it goes out of scope? Or does it make a copy of myBSTR and produce a memory leak if i dont free myBSTR? If this produces a memory leak, what's the most efficient way of handling ...

Why is my Content-Length header wrong?

I am trying to find out the exact length of a string using strlen() in php 5.2. The string ($data) contains '\t' and '\n'. echo strlen($data); Code: // fetch table header $header = ''; while ($fieldData = $result->fetch_field()) { $header .= $fieldData->name . "\t"; } // fetch data each row, store...

Best way to compare complex strings in SQL or .NET

I feel like a bit of a newbie posting this, but anyway: I have a large number of stock items, 3000-5000 which have complex names, based on whoever has entered the items over a period of 16 years, and example of a name is: "Food, Dog, Pal Meaty Bites chunks 8kg bag" Another, related item is named: "DOG FOOD: Meaty Bites (Pal) 22kg ba...

Why am I getting System.char[] printed out in this case?

I'm trying to figure out what I'm doing wrong here, but I can't seem to. I have this method that takes in a string and reverses it. However, when I print out the reversed string from the caller method, I just get "System.Char []" instead of the actual reversed string. static string reverseString(string toReverse) { char...

Read and delete text between two strings in perl

I need a way to read and delete text between two different strings found in some file, then delete the two strings. Like a "cut command." I would like to have the text stored in a variable. I saw the post about reading text between two strings, but I could not figure out how to delete it as well. I intend to execute the stored text i...

PHP - Add String to Array

Hello everyone, I am wondering how I can add a string variable to the current array. For example, I have an array called $finalarray. Then I have a loop that adds a value on every run. Basically: $finalarray = $results_array + string; A very basic structure. I am using this for MySQL so that I can retrieve the final array of the colu...

What is the cost / complexity of a String.indexof() function call

What is the cost / complexity of a String.indexof() function call ...

How would i call a intent and put it into my vector?

b = this.getIntent().getExtras(); s = this.getIntent().getStringExtra("DEFAULTTEXT"); public void onClick(View v) { String a = "http://152.226.152.156:1010/jsp-examples/test1"; URL url = null; HttpURLConnection httpurlconnection = null; try { ...

How the StringBuilder class is implemented? Does it internally create new string objects each time we append?

How the StringBuilder class is implemented? Does it internally create new string objects each time we append? ...

BestPractice - Transform first character of a string into lower case

I'd like to have a method that transforms the first character of a string into lower case. My approaches: 1. public static string ReplaceFirstCharacterToLowerVariant(string name) { return String.Format("{0}{1}", name.First().ToString().ToLowerInvariant(), name.Substring(1)); } 2. public static IEnumerable<char> FirstLetterToLow...

String concatenation does not work in SQLite

I am trying to execute a SQlite replace function, but use another field in the function. select locationname + '<p>' from location; In this snip, the result is a list of 0s. I would have expected a string with the text from locationname and the '<p>' literals. ...

manipulate a string in django to show past/future tense

I'm looking for a way to manipulate a string depending if it's in the past or the future, so I want to: Test to see if it's now or in the future add an "s" to the string Test to see if it's in the past add a "d" to the string I know this has come up before, but didn't find it in a search. Thanks! Wendy ...

How to find all cycles of a String in Ruby ?

Hi, I have written a method in Ruby to find all the circular combination of a text x = "ABCDE" (x.length).times do puts x x = x[1..x.length] + x[0].chr end Is there a better way to implement this ? ...

UNIX BASH: extracting number from string

This is probably a very simple question to an experienced person with UNIX however I'm trying to extract a number from a string and keep getting the wrong result. This is the string: 8962 ? 00:01:09 java This it the output I want 8962 But for some reason I keep getting the same exact string back. This is what I've tried pid=$(e...