I have this java string:
String bla = "<my:string>invalid_content</my:string>";
How can I replace the "invalid_content" piece?
I know I should use something like this:
bla.replaceAll(regex,"new_content");
in order to have:
"<my:string>new_content</my:string>";
but I can't discover how to create the correct regex
help please :)...
I'm having a problem passing strings that exceed 80 characters in JSON. When I pass a string that's exactly 80 characters long it works like magic. But once I add the 81st letter it craps out. I've tried looking at the json object in firebug and it seems to think the string is an array because it has an expander next to it. Clicking the ...
As per the title, I'm trying to find a way to programmatically determine the longest portion of similarity between several strings.
Example:
file:///home/gms8994/Music/t.A.T.u./
file:///home/gms8994/Music/nina%20sky/
file:///home/gms8994/Music/A%20Perfect%20Circle/
Ideally, I'd get back file:///home/gms8994/Music/, because that's th...
I want to create an array/list of strings of the Comma seperated strings (file extensions) that are entered in a Textbox.
For the following block of code:
Dim csv As String = Textbox1.Text + ","
While csv.IndexOf(".") <> -1
lstOfStrings.Add(csv.Substring(0, csv.IndexOf(",")))
csv...
Hi,
I'm trying to make a method that returns a string of words in opposite order.
IE/ "The rain in Spain falls mostly on the"
would return: "the on mostly falls Spain in rain The"
for this i am not supposed to use any built in Java classes just basic java
So far i have:
lastSpace = stringIn.length();
for (int i = strin...
simple q.
in Oracle 9.2, how to compare LONG Type containing String text to a Column of VARCHAR2.
select * from table1 t1, table2 t2 where t1.long_value = t2.varchar2_value
how can i execute such a query the easiest way?
...
Let's say I have two strings: a and b. To compare whether a and be have the same values when case is ignored, I've always used:
// (Assume a and b have been verified not to be null)
if (a.ToLower() == b.ToLower())
However, using Reflector, I've seen this a few times in the .NET Framework:
// (arg three is ignoreCase)
if (string.Com...
Assuming that I want to use a hash as an ID instead of a numeric. Would it be an performance advantage to store them as BINARY over non-binary?
CREATE TABLE `test`.`foobar` (
`id` CHAR(32) BINARY CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
PRIMARY KEY (`id`)
)
CHARACTER SET ascii;
...
I've been looking through the ANTLR v3 documentation (and my trusty copy of "The Definitive ANTLR reference"), and I can't seem to find a clean way to implement escape sequences in string literals (I'm currently using the Java target). I had hoped to be able to do something like:
fragment
ESCAPE_SEQUENCE
: '\\' '\'' { setText("'")...
Does String.ToLower() return the same reference (e.g. without allocating any new memory) if all the characters are already lower-case?
Memory allocation is cheap, but running a quick check on zillions of short strings is even cheaper. Most of the time the input I'm working with is already lower-case, but I want to make it that way if ...
Hi
I'm working in a C++ unmanaged project.
I need to know how can I take a string like this "some data to encrypt" and get a byte[] array which I'm gonna use as the source for Encrypt.
In C# I do
for (int i = 0; i < text.Length; i++)
buffer[i] = (byte)text[i];
What I need to know is how to do the same but using unmanaged C++....
In my code there are several strings which are used as keys to access resources. These keys have a specific format, e.g.
string key = "ABC123";
Currently, all these keys are stored as strings, but I'd like to make things more robust and type-safe. Ideally, I'd like to check the strings are in the correct format at compile time.
The n...
For instance. I have some structure:
s_Some{
std::string lable;
s_some_junk some_junk;
};
And a vector:
std::vector<s_Some> mSome;
And then I fill this vector with a lot of s_Somes.
I need to find an iterator for a single s_Some in this vector, which has a specific lable. So far I just iterate through all of this junk and mat...
In .Net why is String.Empty read only instead of a constant? I'm just wondering if anyone knows what the reasoning was behind that decision.
...
This would have been a lot easier if not for certain situations.
Sample data:
KENP989SD
KENP913E
KENPX189R
KENP913
What regular expression can I use to remove all characters from the string starting at the first non-alpha character? Basically, I want to find the first non-alpha character and chop everything off after that regardless ...
I am trying to copy the value in bar into the integer foo.
This is what I have so far. When I run it I get a different hex value. Any help would be great.
int main()
{
string bar = "0x00EB0C62";
int foo = (int)bar;
cout << hex << foo;
ChangeMemVal("pinball.exe", (void*) foo, "100000", 4);
return 0;
}
So the ou...
How can I use the ReverseString function in Delphi2009?
...
Yesterday, I got bit by a rather annoying crash when using DLLs compiled with GCC under Cygwin. Basically, as soon as you run with a debugger, you may end up landing in a debugging trap caused by RtlFreeHeap() receiving an address to something it did not allocate.
This is a known bug with GCC 3.4 on Cygwin. The situation arises because ...
I've been using the "==" operator in my program to compare all my strings so far.
However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug.
Is "==" bad?
When should it and should it not be used?
What's the difference?
Thanks
...
I am coding VB.NET in VS2008.
I have a comma delimited string of numbers, i.e. 16,7,99,1456,1,3
I do this in VB:
Dim MyArr() As String = MyString.Split(",")
Will MyArr keep the items in the order they were in the string?
If I do this:
For Each S as String in MyString.Split(",")
'Do something with S
'Will my items be in the...