I have a body of text returned from a search query, lets call it $body. Now, what I want to do is for the script to find the first occurrence of the search query, $query. I know I can find this first occurrence this with strripos.
Once found, I want the script to return a couple of words before the first occurrence of the string as ...
I need to search through an html doc, find all of the spans and delete the spans and everything between them. What would a regular expression look like that would match everything between ?
...
I want to use the Split function on a string but keep the delimiting sequence as the first characters in each element of the string array. I am using this function to split HTML on every instance of a URL so I can run regex patterns on the URLs on a website. Is there any overloads of the split function to do this? or do I have to write m...
I want to connect up to a database server in my .NET app and execute a database command that produces a series of database statistics. The problem is that it doesn't return the stats in a structured format, it returns it in plain text (like a df -k command in UNIX) I can capture the output and parse it, but I was wondering if there's a...
Hi
i wish to modify a string. In ssis I have a step which is a "Derived column transformation editior". I have a string such as:
edit=style?form=exy?test=x~~StringIWantToRemove
I wish to remove "~~StringIWantToRemove"
"~~" is the delimiter
"StringIWantToRemove" is a random string og any value (apart from the delimiter)
I would try ...
I've got data in SQL Server 2005 that contains html tags and I'd like to strip all that out, leaving just the text between the tags. Ideally also replacing things like < with <, etc.
Is there an easy way to do this or has someone already got some sample sql code?
I don't have the ability to add extended stored procs and the like, so...
Hello. I want to print a list to screen in a readable way. I use a loop to go through each element and make a new list which is formatted with commas and newlines. The problem is that in the first line of the output, I want a title. E.g., I want to print something like this:
List: red, green, blue, black, cars,
busses, ...
The p...
I've got a JSP page with a piece of Javascript validation code which limits to a certain amount of characters on submit. I'm using a <textarea> so I can't simply use a length attribute like in a <input type="text">.
I use document.getElementById("text").value.length to get the string length. I'm running Firefox 3.0 on Windows (but I've ...
Given a string with replacement keys in it, how can I most efficiently replace these keys with runtime values, using Java? I need to do this often, fast, and on reasonably long strings (say, on average, 1-2kb). The form of the keys is my choice, since I'm providing the templates here too.
Here's an example (please don't get hung up on...
I have a method which takes String argument.In some cases i want to pass int value to that method.For invoking that method i want to convert int into String.For that i am doing the following
aMethod(""+100);
One more option is
aMethod(String.valueOf(100));
Both are correct.I don't know which is appropriate?Which gives bett...
Take a string such as:
In C#: How do I add "Quotes" around string in a comma delimited list of strings?
and convert it to:
in-c-how-do-i-add-quotes-around-string-in-a-comma-delimited-list-of-strings
Requirements:
Separate each word by a dash and remove all punctuation (taking into account not all words are separated b...
CodeSmith has a nice StringUtils class that can be used to change database object names to singular, plural, camel case, pascal case, etc... Very useful for creating data access layers in their code generation tool.
I'm trying to port some CodeSmith templates to the T4 template files used by Visual Studio, and I'm trying to find a si...
I'm using a string builder to build some SQL Scripts. I have a few Boolean Properties that I would like to test and then output different text based on true/false. I've you the C# syntax below when assigning a value to a variable, but it isn't working for this particular situation. Any ideas?
What I'm used to doing:
string someText ...
If I have a string such as
"17:31:51 up 134 days, 11:26, 1 user, load average: 0.22, 0.15, 0.10"
what is the best way to extract just the x3 load average values at the end? I have written a regexp that does this but is this the most efficient / fastest method?
>>> s = "17:31:51 up 134 days, 11:26, 1 user, load average: 0.22, 0.15,...
I've been tinkering with small functions on my own time, trying to find ways to refactor them (I recently read Martin Fowler's book Refactoring: Improving the Design of Existing Code). I found the following function MakeNiceString() while updating another part of the codebase near it, and it looked like a good candidate to mess with. A...
This may be a bit of a nooby question, I have been trying to get better at ruby recently, and started reading the fantastic The Ruby Programming Language. Something that was mentioned is that string literals are considered mutable, so in a loop it is better to use a variable then a literal, as a new string will get instantiated at every ...
I'm looking to determine whether a string value from a user input (UITextField) is "blank" if it's not nil. Checking if [textField.text isEqualToString:""] isn't quite enough because I want to avoid any blank/whitespace input (like say a few space characters).
There does seem to be an indication of a good solution for my particular pro...
I have the following string (japanese) " ユーザー名" , the first character is "like" whitespace but its number in unicode is 12288, so if I do " ユーザー名".trim() I get the same string (trim doesn't work).
If i do trim in c++ it works ok.
Does anyone know how to solve this issue in java?
Is there a special trim method for unicode?
...
What I am trying to achieve is to merge three strings. Two are provided as strings; firstname and lastname, while the third is a simple comma/space separator. Given the following lines of code:
//Working code
var sep = ", ";
var fullName = myNewBO[0].LastName + sep + myNewBO[0].FirstName;
//Erronous code
var fullName = myNewBO[0].LastN...
Hi,
Is there any way to convert a string to Title case, using JSTL tags?
Thanks in Advance.
...