string-manipulation

concatenating 2 rtf fields stored in blobs with a sql script

I need to concatenate 2 rtf fields stored in 2 separate blob columns (actually they are nvarbinary(max) in sql server). I need to do this with a database script, not in an application. Is there a way? Or the only solution is to remove all the rtf headers, concatenate the "body" of the 2 fields and then recreate the headers? By headers...

Double forward slash in a string using stripos() will not match a string even if it is present?

I ran into a little problem today when I was creating a really quick script to scan lines files in a user specified directory for //todo:... So I had a line like this: if (stripos($data, '//todo:')) { //case-insensitive search ^^ //deal with the data appropriately } This did not find //todo: anywhere in any of the files! This was ...

how to trace mysql trigger or help with this one.

Hello everyone, Is there a way to trace MySql triggers? I am stuck with the following one. I want to calculate a column before insert concatenating two other columns, but there is problem calculated value is always null, i also need to check if one column has comma separated values, in that case i only want the first one, here is the ...

How to change the structure of a name field in mysql

Hi, I have the following problem. My table, say tab1, has name column as follows "LastName, FirstName". I want to make it so that the column becomes "FirstName LastName". Any ideas on how this is to be done? Note that there is no comma present, but i guess that can be easily removed once I figure out how to actually flip the first and ...

How can i select from string?

Dim str as string = "<request id=value1 type=value2>value3</request>" How could select the values as follows... Dim id as string = get the value of id (value1) Dim type as string = get the value of type (value 2) Dim ReadValue3 as string = get the value3 ...

Remove a comma between two specific characters

I currently have the string: "Blah, blah, blah,~Part One, Part Two~,blah blah" I need to remove the comma between the ~ character so it reads. "Blah, blah, blah,~Part One Part Two~,blah blah" Can anyone help me out please? Many thanks, ...

string-manipulation - removing char from string

I currently have the following string in java: "Blah, blah, blah,~Part One, Part Two~,blah blah" I need to remove the comma between the ~ character so it reads. "Blah, blah, blah,~Part One Part Two~,blah blah" Can anyone help me out please? Many thanks, ...

How to concatenate multiple rows?

I have the following query which returns the salary of all employees. This work perfectly but I need to collect extra data that I will aggregate into one cell (see Result Set 2). How can I aggregate data into a comma separated list? A little bit like what Sum does, but I need a string in return. SELECT Employee.Id, SUM(Pay) as Salary F...

How can I replace any word within a string that starts with an '@' symbol like Twitter does, in Javascript/JQuery?

I'm trying to make any '@sometext' an HTML link where 'sometext' is also appended to a url. i.e. '@sometext' becomes a link to 'http://someurl.com/sometext'. But so it can change because the link will be different everytime depending on what 'sometext' is. I'm writing this in javascript and jquery. I'm trying to recreate links similar to...

How to parse a SQL Query statement for the names of the tables

I have a string representing a SQL query, and I need to extract the names of the tables from that string. For example: SELECT * FROM Customers Would return "Customers". Or SELECT * FROM Customers c, Addresses a WHERE c.CustomerName='foo' SELECT a.AddressZip FROM Customers c INNER JOIN Addresses a ON c.AddressId=a.AddressId Would r...

What is a regular expression that find a line like this: <rect **** />

Hi, I want a regular expression that could be used to find the following lines: <rect width='10px' height ='20px'/> <rect width='20px' height ='22px'/> <circle radius='20px' height ='22px'/> and replace them by the these lines: <rect width='10px' height ='20px'></rect> <rect width='20px' height ='22px'></rect> <circle radius='20px' h...

store a text string in latex and then add other text to it (concatenate)

I start by defining a command to store the string "Hello": \newcommand{\textstring}{Hello} I would like to append the string " world" but unfortunately this code causes an error: \renewcommand{\textstring}{\textstring world} ...

String operation...

What's simplest way to turn the string "YingYang" into "Ying/Yang"? ...

Search Wildcard('<', '>'), count it and get the position in java

Hi, I want to search Wildcard('<', '>') in a string, count them and get their positions in java. My string is like below Peter <5554>, John <5556>, which function should I use? Thank you. ...

How to correctly assign a new String value in C

Hi, i'm trying to understand how to solve this trivial problem in C in the cleanest/safest way: A simple String replacement. Here's my example: #include <stdio.h> int main(int argc, char *argv[]) { typedef struct { char name[20]; char surname[20]; int unsigned age; } person; //Here i can pass s...

How to convert PUNICODE_STRING to bstr?

Hello I'm calling a function which is in a ComVisible managed dll from a VC++ code. In the managed dll the function parameter type is string. In the VC++ code i've the variable as PUNICODE_STRING. How can i pass it to the function? How can i convert it into BSTR? Thank you. NLV ...

Programmatically derive a regular expression from a string.

I would like to input a string and return a regular expression that can be used to describe the string's structure. The regex will be used to find more strings of the same structure as the first. This is intentionally ambiguous because I will certainly miss a case that someone in the SO community will catch. Please post any and all po...

RegEx Help.. something wrong in my pattern...

I'm looking to match this pattern: ((##.##.##)) Any series of Numbers/Decimals, surrounded by "((" and "))", and preceded by one whitespace There can't be any characters in the middle except digits and periods. Right now I have "\s(\(){2}[\d\.]+(\)){2}" but i'm not getting any matches... ...

How to override functions from String class in C#.

For example, I need to see if a string contains a substring, so I just do: String helloworld = "Hello World"; if(helloworld.Contains("ello"){ //do something } but if I have an array of items String helloworld = "Hello World"; String items = { "He", "el", "lo" }; I needed to create a function inside the String class that would r...

.NET Method to Convert a String to Sentence Case

I'm looking for a conversion function to convert a string of text that is in UpperCase to SentenceCase, all the examples I can find turn the text into TitleCase. Sentence case in a general sense describes the way that capitalization is used within a sentence. Sentence case also describes the standard capitalization of an Engl...