How do I replace multiple spaces with a single space in C#?
How can I replace multiple spaces in a string with only one space in C#? Example "1 2 3 4 5" would be : "1 2 3 4 5"? ...
How can I replace multiple spaces in a string with only one space in C#? Example "1 2 3 4 5" would be : "1 2 3 4 5"? ...
The string formatting concept found in sprintf can be found in almost any language today (you know, smothering a string with %s %d %f etc. and providing a list of variables to fill their places). Which langugage was it originally that had a library function or language construct which offered this functionality? Please specify some ki...
Can anyone give me a complete list of string manipulation function in Microsoft SQL Server (2000 or 2005)? (I don't need a lecture about doing all my string processing in the presentation layer. And, I don't need a list of MySQL string functions.) Thanks! ...
I have a string. string strToProcess = "fkdfdsfdflkdkfk@dfsdfjk72388389@kdkfkdfkkl@jkdjkfjd@jjjk@"; I need to add a newline after every occurence of "@" symbol in the string. My Output should be like this fkdfdsfdflkdkfk@ dfsdfjk72388389@ kdkfkdfkkl@ jkdjkfjd@ jjjk@ ...
Using bash, I have a string: string=`echo My string` How can I test if it contains another string? if [ $string ?? 'foo' ] then; echo "It's there!"; fi; Where ?? is my unknown operator. Do I use echo and grep? if [ `echo $string || grep 'foo' ` ] then; echo "It's there!"; fi; That looks a bit clumsy. ...
Hi, I am trying to manipulate a string using Jython, I have included below an example string: This would be a title for a website :: SiteName This would be a title for a website :: SiteName :: SiteName I am trying to remove all instances of ":: Sitename" or ":: SiteName :: SiteName", can anyone help me out? Cheers ...
I'm trying to change user input in wildcard form ("*word*") to a regular expression format. To that end, I'm using the code below to strip off the '*' at the beginning and end of the input so that I can add the regular expression characters on either end: string::iterator iter_begin = expressionBuilder.begin(); string::iterator i...
How can I replace Line Breaks within a string in C#? ...
I have a string that I need to convert to the equivalent array of bytes in .NET. This ought to be easy but I am having a brain cramp. ...
I have many articles in a database (with title,text), I'm looking for an algorithm to find the X most similar articles, something like Stack Overflow's "Related Questions" when you ask a question. I tried googling for this but only found pages about other "similar text" issues, something like comparing every article with all the others...
I'm trying to convert some strings that are in French Canadian and basically, I'd like to be able to take out the French accent marks in the letters while keeping the letter. (E.g. convert é to e.) What is the best method for achieving this? ...
Language: C# Hello, I'm writing an application that uses renaming rules to rename a list of files based on information given by the user. The files may be inconsistently named to begin with, or the filenames may be consistent. The user selects a list of files, and inputs information about the files (for MP3s, they would be Artist, Tit...
Hi. I am working with a huge list of URL's, you guys have already helped me :) Just a quick question I have trying to slice a part of the URL out, see below: http://www.domainname.com/page?CONTENT_ITEM_ID=1234&param2&param3 How could I slice out: http://www.domainname.com/page?CONTENT_ITEM_ID=1234 Sometimes there is more ...
This should be easy, but I'm having a hard time finding the easiest solution. I need an NSString that is equal to another string concatenated with itself a given number of times. For a better explanation, consider the following python example: >> original = "abc" "abc" >> times = 2 2 >> result = original * times "abcabc" Any hints? ...
Quick add on requirement in our project. A field in our DB to hold a phone number is set to only allow 10 characters. So, if I get passed "(913)-444-5555" or anything else, is there a quick way to run a string through some kind of special replace function that I can pass it a set of characters to allow? Regex? ...
I've done some Googling, and can't find anything, though maybe I'm just looking in the wrong places. I'm also not very adept at VBA, but I'm sure I can figure it out with the right pointers :) I have a string I'm building that's a concatenation of various cells, based on various conditions. I hit these in order. =IF(A405<>A404,G405,G40...
I need to find two adjacent repeating digits in a string and replace with a single one. How to do this in Java. Some examples: 123345 should be 12345 77433211 should be 74321 ...
It seems like there should be a simpler way than: import string s = "string. With. Punctuation?" # Sample string out = s.translate(string.maketrans("",""), string.punctuation) Is there? ...
I have the following code block in my xslt; <xsl:when test="StatusData/Status/Temperature > 27"> <td bgcolor="#ffaaaa"> <xsl:value-of select="StatusData/Status/Temperature" /> </td> </xsl:when> But as you might guess when the value is 34,5 instead of 34.5 it is recognis...
Multistrings (double null-terminated string of null-separated strings) are common in the Windows API. What's a good method for converting a multistring returned from an API to a C# string collection and vice versa? I'm especially interested in proper handling of character encoding (Windows XP an later). The following method seems to be...