string

Java Cut Links from shoutcast stream url

the string [playlist]numberofentries=2File1=http://66.162.107.142/cpr1_K128OV.oggTitle1=KCFR NewsLength1=-1File2=http://66.162.107.141:8000/cpr1_K128OV.oggTitle2=KCFR News BackupLength2=-1Version=2 i wanna cut all of the links in this file, how to? ...

How to store a string from a text file in an array in C

I want to read a text file into a string array and be able to access the array contents through a loop. The code I have allows me to store only the last line of the text file instead of the entire file; where am I going wrong? #define MAX 10000 int main (int argc, char *argv[]) { FILE *fp; char str[MAX]; char *x[MAX]; i...

Include code in string definition?

I have a string $string = "Active Directory" and I want to make another string Active_Directory_Results.txt I would like to just do $otherstring = "$string.Replace(" ","_")_Results.txt" but that doesn't work out. What would be the correct way to pull this off? ...

escaping string for json result in asp.net server side operation

I have a server side operation manually generating some json response. Within the json is a property that contains a string value. What is the easiest way to escape the string value contained within this json result? So this string result = "{ \"propName\" : '" + (" *** \\\"Hello World!\\\" ***") + "' }"; would turn into string res...

elegant way to match two wildcarded strings

I'm OCRing some text from two different sources. They can each make mistakes in different places, where they won't recognize a letter/group of letters. If they don't recognize something, it's replaced with a ?. For example, if the word is Roflcopter, one source might return Ro?copter, while another, Roflcop?er. I'd like a function that r...

What's the best way to slurp the contents of a file into a string in Mathematica?

I know this is asked commonly but googling doesn't turn up a definitive answer for Mathematica so I thought it would be valuable to have this on StackOverflow. I've been doing this with Import but it occurred to me that that might be horribly inefficient, Import being such a heavyweight function. So the question is, can you improve on ...

Modify CSV field on import to mysql

I'm trying to import a CSV file to a mysql database. The CSV file contains (amongst other things) dates in the following format: "2010-04-31 17:43:12" My first approach was to use the following .sql script: USE test; LOAD DATA INFILE '/tmp/test.cvs' replace INTO TABLE test_table FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (......

Setter and getter not working

This is my assignment about setter and getter and it is not working for some reason. Could anyone check what the problem is for me? Thank you. public class FlightTest { public static void main (String [] args) { String name; String number; String Orig; String Desti; Scanner scan = new Sc...

Remove specific characters from a string in python

I'm trying to remove specific characters from a string using python. This is the code i'm using right now. Unfortunately it appears to do nothing to the string?? for char in line: if char in " ?.!/;:": line.replace(char,'') ...

C++ program instruction

I have written out the program, however once I tried compileing it a get syntax errors and cannot fine where the syntax errors are. Would you know why my program won't compile? It should calculate number of second sound travels in difference gases, information given by user. include <iostream> #include <fstream> using namespace std; ...

How can this Java code be improved to find sub-string in a string?

Hi, I was recently asked to submit a solution to a problem for a job. Problem: Find a sub-string in a string. Input: "Little star's deep dish pizza sure is fantastic." Search: "deep dish pizza" Output: "Little star's [[HIGHLIGHT]]deep dish pizza[[ENDHIGHLIGHT]] sure is fantastic." Note that the highlighter doesn't have to have...

How to find a similar word for a misspelled one in PHP?

I'll explain my problem: I have a database table called country. It has two columns: ID and name. When I want to search for 'paris', but misspelled the word: 'pares' ('e' instead of 'i'), I won't get any result from DB. I want the the system to suggest similar words that could help in the search. So, I am looking for help writing a s...

PHP: Replacing funny character on PHP

Hi all, I'm trying to replace string "Red Dwarf (TV Series 1988â€") - IMDb" to "Red Dwarf (TV Series 1988') - IMDb" I have a translation table of these funny characters in an array. I tried to replace them using: str_replace but it did not work. Can anybody suggest a workaround on this? This is the snippet of the code: function repla...

How to split this string with python?

I have strings that look like this example: "AAABBBCDEEEEBBBAA" Any character is possible in the string. I want to split it to a list like: ['AAA','BBB','C','D','EEEE','BBB','AA'] so every continuous stretch of the same characters goes to separate element of the split list. I know that I can iterate over characters in the string, che...

Can we load string resources from a resource file other than strings.xml in Android?

I want to provide different resource files to users. But I don't know how to load strings from a resource file other than strings.xml? ...

string filtering on c++

given a string literal in c++ i have to remove toxic words like stupid etc by ###. Suppose i have my toxic words in an array like char[][]={"...",".."...and more...} and my string is like char str[]="......." any particular library func that could help me here. thanks in advance for help ...

Counting repeated words in a file

hi, Goal: to find count of all words in a file. file contains 1000+ words My approach: use a HashMap() to store and count the number of times each word appears in the file. Question: Would a HashMap() be the best way or would it be better to use a Binary Tree for ensuring faster lookup as there is a large count of words in the file? ...

Regex in Python

I have the following string: schema(field1, field2, field3, field4 ... fieldn) I need to transform the string to an object with name attribute as schema and the field names as another attribute which is a list. How do I do this in Python with a regular expression? ...

Calling php methods with strings

I have two objects. Object A and B. A has a method which returns B. And I want to call this dynamically so I use a string for calling a method inside of B like so: $method = 'getB()->someMethod'; But if do this: $a = new A(); $a->$method(); It doesn't work. Any ideas? ...

How to search same pattern in a string and then take them to array in Java?

For example, The string is: "{{aaa,bbb},{ccc,ddd},{eee,fff}}" I want the program auto split it as a string pattern Pattern is: {{...},{...},{...}} What is the Pattern Matching regex? ...