string

Why not DriverManager.getConnection(String url, String user, char[] password)?

We know it's a good practice to prefer char[] over java.lang.String to store passwords. That's for the following two reasons (as I have read): char[] are mutable so we can clear the passwords after the usage. String literals goes to a pool that will not get garbage collected as other objects, hence might appear in memory dumps. But j...

ldap search filter with java

Hi all. I'm having problems with ldap search filters. I want to search through all the children of a root node. I want the users where the username of the email contains the query string. for example, if I have [email protected] foobar@foo_l.c_bar and the search query is "l.c" I want only [email protected] the following co...

Merge string with common middle part

Hello ! I have two strings: $a = '/srv/http/projects/name'; $b = '/projects/name/some/dir'; And I would like to get a merged string with not repeated common part: $c = '/srv/http/projects/name/some/dir'; Is there any effective way to get it ? ...

parse utf code in vbscript

Is there a way to parse utf codes in vbscript? What I'd like to do is replace all codes like "\u00f1" in a string for its corresponding character. ...

Converting float to string and getting exact value

This is follow up for my last question about converting string to float I have this value stored in a float variable: 33.9112625 (it's thirty three) and I need to convert it to string and get the exact value but I'm unable to do so. float.ToString( CultureInfo.InvariantCulture) gives me "33.91126" as result. I tried .ToString("G"), "G7"...

grep and sed command question

Hi there i have a truckload of files with sql commands in them, i have been asked to extract all database table names from the files How can I use grep and sed to parse the files and create a list of the unique table names in a text file ..one per line? the name names all seem to start with "db_" which is handy! what would be the best ...

Python, int to hex string

I want to take an integer (that will be <= 255), to a hex string representation eg: I want to pass in 65 and get out '\x65', or 255 and get '\xff' I've tried doing this with the struct.pack('c', 65), but that chokes on anything above 9 since it wants to take in a single character string. Thanks, ...

What's the cause of this Access Violation when concatenating strings in D2007?

I have a procedure that accepts 2 string parameters, one of them has a default value. Inside the procedure, I want to concatenate one and the other and some literals to form one larger string. Somehow, I'm getting an AV... any ideas? code is something like this {$WRITEABLECONST ON} constructor MyClass.Create(s1: string; s2: string = Gl...

How to determine the size of an array of strings in C++?

I'm trying to simply print out the values contained in an array. I have an array of strings called 'result'. I don't know exactly how big it is because it was automatically generated. From what I've read, you can determine the size of an array by doing this: sizeof(result)/sizeof(result[0]) Is this correct? Because for my program, ...

Delete String Elements

How to delete the last element of a string. If 'globe' is the value given by user, how to store it as 'glob'. That is excluding last element. ...

String isNullOrEmpty in Java?

This surely has been asked before, but Googling doesn't find it. Is there, in any of the standard java libraries (including apache/google/...), a static isNullOrEmpty() method for Strings? ...

Regex divide with upper-case

Hi, I would like to replace strings like 'HDMWhoSomeThing' to 'HDM Who Some Thing' with regex. So I would like to extract words which starts with an upper-case letter or consist of upper-case letters only. Notice that in the string 'HDMWho' the last upper-case letter is in the fact the first letter of the word Who - and should not be i...

String + String

Possible Duplicate: How do I concatenate strings in Objective-C? hi im working with iphone sdk and i need to add string to another string like in java is the ' += ' but in objective-c i don't know.. thx for help! ...

Immutable readonly reference types & FXCop Violation: Do not declare read only mutable reference types

I have been trying to wrap my head around this FXCop violation "DoNotDeclareReadOnlyMutableReferenceTypes" MSDN: http://msdn.microsoft.com/en-us/library/ms182302%28VS.80%29.aspx Code from MSDN which would cause this violation: namespace SecurityLibrary { public class MutableReferenceTypes { static protected readonly St...

In java, how to check if a string contains a substring , ( ignoring the case ) ?

I have two Strings: str1 and str2. How to check if str2 is contained within str1, ignoring case? ...

Evaluating a string as a mathematical expression in javascript

If I have a string '1+1' is there a way, other than eval(string) to get the numerical value of it i.e. I want to turn '1+1' into 2. ...

Python: Split a string at uppercase letters

What is the pythonic way to split a string before the occurrences of a given set of characters? For example, I want to split 'TheLongAndWindingRoad' at any occurrence of an uppercase letter (possibly except the first), and obtain ['The', 'Long', 'And', 'Winding', 'Road']. Edit: It should also split single occurrences, i.e. from 'ABC'...

Regarding Java Split Command CSV File Parsing

I have a csv file in the below format. I get an issue if either one of the beow csv data is read by the program "D",abc"def,"","0429"292"0","11","IJ80","Feb10_1.txt-2","FILE RECORD","05/02/2010","04/03/2010","","1","-91","","" "D","abc"def","","04292920","11","IJ80","Feb10_1.txt-2","FILE RECORD","05/02/2010","04/03/2010","","1","-91...

Some problem using pointers to enter a string.

Hi all , I'm a beginner and i need to ask a question.. I wrote this small code that accepts a string from the user and prints it..very simple. #include <iostream> using namespace std; int main() { int i; char *p = new char[1]; for(i = 0 ; *(p+i) ; i++) *(p+i) = getchar(); *(p+i) = 0; for(i = 0 ; *(p+i) ; i++) ...

Splitting string only it meets requirements in C#

I'm trying to split a song title into two strings- the artist and song. I receive the original string like this: "artist - song". Using this code, I split the string using '-' as the spliiter: char[] splitter = { '-' }; string[] songInfo = new string[2]; songInfo = winAmp.Split(splitter); This works fine and all, except wh...