string-manipulation

help with php dates and loops

Hello I currently have this PHP Script <?php if($purchase_dates != FALSE){?> <?php foreach($purchase_dates as $id=>$outer_value) { ?> <!-- Output the date here --> <!-- Start Purchase table --> <? $date =...

How to remove "&nbsp;" from java string

I have a java string with "&nbsp;" from a text file the program accesses with a Buffered Reader object. I have tried string.replaceAll("&nbsp;","") and it doesn't seem to work. Any ideas? cleaned = cleaned.replace("&nbsp;"," "); ...

Splitting a changing string with perl

I have a bunch of strings in perl that all look like this: 10 NE HARRISBURG 4 E HASWELL 2 SE OAKLEY 6 SE REDBIRD PROVO 6 W EADS 21 N HARRISON What I am needing to do is remove the numbers and the letters from before the city names. The problem I am having is that it varies a lot from city to city. The data is almost never the same. Is...

Help on Regular Expression problem

Hi, i wonder if it's possible to make a RegEx for the following data pattern: '152: Ashkenazi A, Benlifer A, Korenblit J, Silberstein SD.' string = '152: Ashkenazi A, Benlifer A, Korenblit J, Silberstein SD.' I am using this Regular Expression (Using Python's re module) to extract these names: re.findall(r'(\d+): (.+), (.+), (.+), (...

SQL Server 2008 : replace string

I have a table with an erroneous symbol('�') in a number of rows in one column. The TSQL script below does not work. UPDATE S SET S.Offering_Details = REPLACE(S.Offering_Details, '�', '...') FROM tblSacrifices S The column in question has datatype of nvarchar(230) and allows null entries. The data came from a csv file converted from...

How to "flip-replace" strings in a file using shell scripting

Hello, I am facing the following problem. Let's say I have a file, which contains something like this: blah blah blah blah more text <tag1>something</tag1> <tag2>something else</tag2> blah blah meh whatever foo bar What I want to do is to replace all occurrences of tag1 with tag2, and all occurences of tag2 with tag1. However, I don'...

Get String Between 2 Strings

How can I get a string that is between two other declared strings, for example: String 1 = "[STRING1]" String 2 = "[STRING2]" Source: "832h0ufhu0sdf4[STRING1]I need this text here[STRING2]afyh0fhdfosdfndsf" How can I get the "I need this text here" using C++. ...

Formatting strings in ASP.NET Razor

I am currently writing a small templating system in ASP.NET to allow users to add content. For example, the user can enter the string (variable type is string). topHeader[x] = "They think it's all over. It is now!"; However, one change that's needed is the ability to add some basic HTML tags within this content, so the following can b...

Extract a specific portion of connection string

Hello, Any way to extract what's after the @(if any) and before the next . (if any)? Examples: host host.domain.com user@host first.last@host [email protected] [email protected] I need to get host in a variable. Suggestions in Python? Any method is welcomed. Thanks, EDIT: I fixed my question. Need to match host and h...

I want one backslash - not two

I have a string that after print is like this: \x4d\xff\xfd\x00\x02\x8f\x0e\x80\x66\x48\x71 But I want to change this string to "\x4d\xff\xfd\x00\x02\x8f\x0e\x80\x66\x48\x71" which is not printable (it is necessary to write to serial port). I know that it ist problem with '\'. how can I replace this printable backslashes to unprintable?...

Why does the istitle() string method return false if the string is clearly in title-case?

Of the istitle() string method, the Python 2.6.5 manual reads: Return true if the string is a titlecased string and there is at least one character, for example uppercase characters may only follow uncased characters and lowercase characters only cased ones. Return false otherwise. But in this case it returns false: >>> book = 'wh...

Splitting a string separated by "\r\n" into a list of lines?

I am reading in some data from the subprocess module's communicate method. It is coming in as a large string separated by "\r\n"s. I want to split this into a list of lines. How is this performed in python? ...

Efficient way of adding one character at a time from one string to another in Python

I'm currently making a function using pygame that draws a message on the screen, adding one character each frame (i.e. The Hunt for Red October). I know that I could simply copy (or pass) gradually bigger slices from the original string, but I know that it would be very resource-intensive. Is there a better way to do this? Code, using...

Problem using stringByReplacingOccurancesOfString in Objective-C

Hi, I'm having some problems working with NSStrings in Objective C... the code below returns a warning, saying: "'NSString' may not respond to '-stringByReplacingOccurancesOfString:withString:" NSString* NewWord = [Word stringByReplacingOccurancesOfString:@"!" withString:@""]; What ...

How to check if a string contains two asterisk characters?

We have a string input and the following combinations are valid (e.g. sunday, *sunday*, sun*day*, *sun*day, su*nda*y) If it contains only a single asterisk, then it is a bad input. So given the above input, how do I check to see if the string contains multiple asterisks. ...

VS Macro/Add-in to convert string concatenations to string.format style

I have project in development where string operations like "Hi " + variable + ", welcome to Project" are used at many places (given example is very minor one). One of the requirement is to convert it to string.format style. It is very long and tedious job, where I would not like to break earlier working code due to any human error migh...

iPhone Java String Code to Object C

Hi, I have 2 String Operations I would need relevant in Object C // Get the newstring from mystring start at counter Java: newstring = mystring.substring(counter) OBJ-C: ? // Get the position from searchstring in mystring Java: startpos = mystring.indexOf(searchstring) ObJ-C: ? Would be great you can help Thx chris Edit: I ha...

How to clean a columns with a dots at the beginning and end of a text using T SQL for SQL Server?

Description: I have a column(EmailsAdress) on a table(BusinessUsers) on my databases that stores email address. Problem: Some of the rows of data have a dot at the beginning of this column for example [email protected] (The dot i want to get rid of is the dot just before the charater j in jane) Some of the rows of data have a...

iPhone remove <![CDATA

Hi, I am reading a xml and finaly just need to remove the CDATA Infos in my results For example: I get: "<![CDATA[iPhone 4-Rückgaberecht: Deutsche Telekom kulant]]>" just need "iPhone 4-Rückgaberecht: Deutsche Telekom kulant" thx chris Edit to your answers: I am not using NSXMLParser (thats the reason I make my own parser) Found ...

sequence of poisson' equations

I want to solve the sequence of poisson equations u = f(k) for different values of k. I tried for k=1:10 f='x+y+k' u(k)=assempde('problg',p,e,t,c,a,f); end It returns the error Undefined function or variable 'k'. Infinitely grateful for any help! ...