break a string in parts
I have a string "pc1|pc2|pc3|" I want to get each word on different line like: pc1 pc2 pc3 I need to do this in C#... any suggestions?? ...
I have a string "pc1|pc2|pc3|" I want to get each word on different line like: pc1 pc2 pc3 I need to do this in C#... any suggestions?? ...
I get a string from a db, then I remove all the HTML tags, carriage returns and newlines, before I put it in a csv. Only thing is I cant remove the excess white space from between the strings, any ideas? Thanks, Joe ...
This is a really weird problem. It's taken me practically all day to whittle it down to a small executable script that demonstrates the problem fully. Problem Summary: I'm using XML::Twig to pull a data snippet from an XML file, then I'm sticking that data snippet into the middle of another piece of data, let's call it parent data. ...
In C, I can do like this: char s[]="hello"; or char *s ="hello"; so i wonder what is the difference? I want to know what actually happen in memory allocation during compile time and run time. ...
I tried to print all the possible combination of members of several vectors. Why the function below doesn't return the string as I expected? #include <iostream> #include <vector> #include <fstream> #include <sstream> using namespace std; string EnumAll(const vector<vector<string> > &allVecs, size_t vecIndex, string strSoFar) {...
Hi, I try to parse RSS chaanal with simple-rss lib. Unfortunately I got a lot of garbage in node: <description><p> some decryption </p> <a href="http://url.com/trac/xxx/wiki/foo?action=diff&amp;amp;version=28"&gt;(diff)&lt;/a&gt;</description> I need to retrieve text ("some description") and o...
In Python, I have just read a line form a text file and I'd like to know how to code to ignore comments with a hash # at the beginning of the line. I think it should be something like this: for if line !contain # then ...process line else end for loop But I'm new to Python and I don't know the syntax ...
Hay all, i need help making a regex. The string must contain a "-" and must not contain a ".". Can someone help me please. ...
Say, I have a string "hello is it me you're looking for" I want to cut part of this string out and return the new string, something like s = string.cut(0,3); s would now be equal to: "lo is it me you're looking for" EDIT: It may not be from 0 to 3. It could be from 5 to 7. s = string.cut(5,7); would return "hellos it me you'...
Buongiorno, I'm trying to send a simple string to a serial port to command an instrument for noise measures. The strings are very easy: "M 1" = instrument on "M 2" = instrument off "M 3" = begin the measure "M 4" = stop the measure I've found this program: import serial ser = serial.Serial(0) #Seleziona la porta seriale COM4 ser.baud...
This is the first time I've came across this. Just printed a list and each element seems to have a u in front of it i.e. [u'hello', u'hi', u'hey'] What does it mean and why would a list have this in front of each element? As I don't know how common this is, if you'd like to see how I came across it, I'll happily edit the post...
Greetings dear Experts! Could you please advice me on how to cope with the problem: @echo off cls setlocal enabledelayedexpansion path=%CD%;%path% set NumberOfPages=553 rem set /A MaxFileIndex=%Counter% - 1 set MaxFileIndex=1 del Output.txt for /l %%i in (0,1,%MaxFileIndex%) do call :GenerateFileList %%i goto :eof :::::::::::::...
We were given an assignment that involved taking information from a file and storing the data in an array. The data in the file is sorted as follows New York 40 43 N 74 01 W the first 20 characters are the name of the city followed by the latitude and longitude. latitude and longitude should be easy with a few fscanf(i...
I have string ling like this: 'Toy Stroy..(II) (1995)' I want to split the line to two parts like this: ['Toy Story..(II)','1995'] How can I do it? thanks ...
Not literally code from space however: I'm wondering if there's a more OO way if creating spaces in C#. I currently have tabs += new String(' '); and I can't help but feel that this is somewhat reminiscent of using '' instead of String.Empty. What can I use to create spaces that isn't ' '? ...
I want to create a function that returns a substring of a specific string from the beginning of said string up to but not including the start of another specific string. Ideas? So something like: substrUpTo(theStr, subStr) so if I inputted substrUpTo("Today is my birthday", "my"), it would return a substring of the first argument u...
Hi, I've a string that may or may not include C++ comments on it (multi-lin and single line) and I need to strip those comments out before being able to use that string. My current idea is to use an NSScanner to do that - find the position of opening and closing multi-line comments and delete that portion of the string and find the posi...
This page has a great example using REGEXP to do pattern matching. the problem with REGEXP won't match the following strings: "Mr John" "Dr. John" or even: "Mr. John Doe" with the string "John Doe" I would like to know how do I get positive matches for any of the given examples? Here is a sample code: Drop table Names; CREATE ...
I am rebuilding a nodes children by saving them out to an array as strings, trashing them in the XML, inserting a new child node into the array as a string... now I want to loop through the array and write them back out to the original node. The problem is I can't find anything on how to add a child node using a string. See below for ...
Having trouble with pattern and replacement. How can I make the replacement echo a final product such as INSERT INTO `table` (`person`, `file`) VALUES ('test','test'), ('test2','test2'), ('test3','test3'); I am trying to insert the string into SQL but I need to format the current string below to do so, and I need to have the last part...