string

Which should i use for empty string and why?

Possible Duplicate: What is the difference between String.Empty and string variableName = ""; or string variableName = string.Empty; ...

What's the quickest, cleanest way to remove parent pathing from a URL string?

In C#, is there any built-in way to "correct" URLs that have parent pathing in them? So, I want to take this: /foo/bar/../baz.html And turn it into... /foo/baz.html (The "bar" directory being negated by the ".." after it in the path.) I've tried to hand-roll this, but the logic gets pretty ugly, pretty quickly. Consider something...

Design guidelines for parser and lexer?

I'm writing a lexer (with re2c) and a parser (with Lemon) for a slightly convoluted data format: CSV-like, but with specific string types at specific places (alphanumeric chars only, alphanumeric chars and minus signs, any char except quotes and comma but with balanced braces, etc.), strings inside braces and strings that look like funct...

Groovy BigInteger to string

I am using i = value.toBigInteger() i.toString(32).toUpperCase() to convert a 16 digit 'number' to characters for use in a serial Is there any way to force this to use the A-Z + 2-7 notation rather than 0-9 + A-V?? ...

How much of the data in a database is string/text data?

I was wondering if there has been any research about how much of the data stored in a databases consists of string data. Also, how much of that string data is free-text data (i.e. completly unstructered) and how much of it consists of identifiers such as proper names. My intuitive feeling is that often the size of a record is mainly defi...

Groovy to Biginteger

As the reverse of i.toString(32) is there a better (i.e. working) method to use instead of i = Integer.parseInt(string, 32) to create a BigInteger, as the string I want to pass is 11 'characters' long? (D4KJI9QLC3L) gives me java.lang.NumberFormatException: For input string: "D4KJI9QLC3L" Parameters:{val=14800099002200181, str=D4KJI9...

Getting string from WCF service.

Hi there, I want to get the string generated by the WCF service, both synchronously and asynchronously. I know that with the bitmap, for instance, it's a piece of cake - you can add the event handler to BitmapImage on e.g. IsDownloaded or something. How about strings? How can I achieve that? Assume that I want to use URi for calling the...

VBScript: how to find the difference between two strings that look identical

There are two strings "test_name" that are compared in a VB script. They have to be identical, and they look identical in debug viewer, but StrCompare(string1, string2) returns 1. History. This is a test in QTP. The first string is read from Excel. The second one is from a windows application. QTP reads a value from Excel, enters it to ...

Call a c++ method that returns a string, from c#

Please help, my c++ function: extern "C" REGISTRATION_API void calculate(char* msg) { //some calculation here msg = "some text"; } my c# call: [DllImport("thecpp.dll")] static extern void calculate(StringBuilder sMsg); private void button4_Click(object sender, EventArgs e) { StringBuilder msg = new Stri...

Bare-minimum text sanitation

In an application that accepts, stores, processes, and displays Unicode text (for the purpose of discussion, let's say that it's a web application), which characters should always be removed from incoming text? I can think of some, mostly listed in the C0 and C1 control codes Wikipedia article: The range 0x00-0x19 (mostly control char...

Getting the src of a list of images PHP

I know it sounds a bit odd but I have a string: <img src="image1.gif" width="20" height="20"><img src="image3.gif" width="20" height="20"><img src="image2.gif" width="20" height="20"> Is there a easy way to get this into an array of array('image1.gif','image3.gif','image2.gif'); Thanks. ...

Removing up to 4 spaces from a string

Hello I have an array of Strings Im looping through. For each string, I need to remove up to 4 spaces from the beginning. In other words, if there are only 2 spaces, I remove 2. If there are 6 spaces I remove 4. How can I specify this in the loop? for(int i=0; i<stringArray.length; i++) { newString = REMOVE UP TO 4 SPACES FROM stri...

Making all the characters in a string lowercase in Lua

Here is the thing. I am trying to convert a string in lowercase in Lua, but it's not working. I have done this String = String:lower() but it doesn't like it. I am sure that is the way to do it, I've seen it done before. A few sites suggest it might be a problem caused by a wrong version of the interpreter. Any ideas? ...

RegExp alphanumeric String + Special Letters

First question : I want to replace all characters other than alphanumeric and Special Letters. For example , somestringğüş iöç123456!@#$%^&*()_+ to somestringğüş iöç123456 Second: For example , some---example--long-string to some-example-long-string I do not really know regexp , so I need 2 simple regexp strings.Thank you ...

WinDbg not telling me where my string is rooted

I am trying to track down why a string is stored so long in my application, and eating up an excessive amount of memory. I have a Windows Service which runs regularly. It reads data from a database (in the form of a DataSet) and then does some processing - all managed .NET. The Windows Service is triggered once every 5 or so minutes,...

PL/SQL String Manipulation

I need to split an address which is a single string into multiple strings. Below are the requirements to for the pl/sql procedure that splits up the address into the corresponding address lines. The parameters of the procedure are: create or replace procedure split_address ( address in varchar2, al1 out varchar2, al2 out varchar2, al3 o...

Passing StringBuilder to PInvoke function

In one of the post Titled "Call a c++ method that returns a string, from c#" Its said that , to make the following Pinvoke to work change the C++ signature to as extern "C" REGISTRATION_API void calculate(LPSTR msg) C++ code extern "C" REGISTRATION_API void calculate(char* msg) C# code [DllImport("thecpp.dll", CharSet=CharSet...

How to read entire stream into a std::string?

I'm trying to read an entire stream (multiple lines) into a string. I'm using this code, and it works, but it's offending my sense of style... Surely there's an easier way? Maybe using stringstreams? void Obj::loadFromStream(std::istream & stream) { std::string s; int p = stream.tellg(); // remember where we are stream.seekg...

[PHP] - String lookup into unknown charset html content

Hi there guys, I'm using strpos to lookup for string into web page bodies. 50% it fails, although the search string is present. I have tried to strtolower both search string and searched content, same results. Probabily the problem arises when dealing with different charsets... Assuming: - search string charset is unknown - searched con...

Convert Octet string to char array

There is a server which sends some data in Octet strings. For example it is sending 00405080065233E like this, then I need to convert this into a string and store it into a buffer. If I decode that converted string it has give the same 000405080065233E octet string again. How can I do this? Can anybody suggest some solution? ...