|
Regular Expression for matching string like:
"<any_string>+<any_string>+<any_string>"?
Started by ParagM on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
Is this what you are after?
[\w\\+]*
maybe try this
/.*\+.*\+.*/
If any_string would not contain is the same string, which is < ....
It sounds as simple as:
.*\+.*\+.*
the .* matches any_string until the \+ matches a "+" symbol.
|
Vb.net string concatenation string + function output + string = string + function output and no more
The following output produces a string with no closing xml tag.
m_rFlight.Layout = m_rFlight.Layout + "<G3Grid:Spots>" + Me.gvwSpots.LayoutToString() + "</G3Grid:Spots>"
This following code works correctly
m_rFlight.Layout = m_rFlight.Layout...
Started by Barfieldmv on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Consider the following code that should be the equivalent of your code:
Dim someString As String;
If you don't get the same results then it's because either m_rFlight.Layout is not a string, or Me.gvwSpots.LayoutToString() doesn't return....
|
|
Which is more efficient for the compiler and the best practice for checking whether a string is blank?
Checking whether the length of the string == 0 Checking whether the string is empty (strVar == "") Also, does the answer depend on language?
Started by Haydar on
, 13 posts
by 12 people.
Answer Snippets (Read the full thread at stackoverflow):
That's an O(1) operation, ....
Http://msdn.microsoft.com/en.
Pascal-type strings the best way to determine is the IsNullOrEmpty() method of the string class.
Yes, it depends on language, since string storage differs between languages.
|
Ask your Facebook Friends
|
I'm a C++ guy learning Java. I'm reading Effective Java and something confused me. It says never to write code like this:
String s = new String("silly");
Because it creates unnecessary String objects. But instead it should be written like this:
String...
Started by JavaNewbie on
, 15 posts
by 15 people.
Answer Snippets (Read the full thread at stackoverflow):
Nor can you extend ....
There's no way for your SomeStringClass cis = "value" example to apply to any other class .
String s are special in Java - they're immutable, and string constants are automatically turned into String objects.
|
|
I like to encode a java map of strings as a single base 64 encoded string. The encoded string will be transmitted to a remote endpoint and maybe manipulated by a not nice person. So the worst thing that should happen are invaild key,value-tuples, but ...
Started by Chris on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
The the encoding then would look like this:
JSONObject jso = new JSONObject( map ); String encoded = new String(Base64.encodeBase64( jso.toString( 4 ).toByteArray()));
my primary requirements are: encoded string should be as short....
|
|
Ended up with this awful data structure:
List<KeyValuePair<string, KeyValuePair<string, string>>>
It's not likely to get huge (<1K I estimate) and I am gonna iterate this list over and over.
Anyone can think of some better alternative...
Started by JohnIdol on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Struct MrStruct { public string Key1, public string Key2, public string Value1 } List<Tuple<string,string,string>>
This is easy enough to write in .NET 2.0 - it's basically just dramatically speed up any ....
|
|
What is the most suitable container just for strings holding in some array with non-predetermined upper boundary, which length is unknown on it's creation.
For simple code like:
Foo list = new Foo(); // size in unknown for()/foreach()/do()/while() // ...
Started by abatishchev on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
A StringCollection is just a type safe.
Have to cast the items to String when reading from it.
|
|
What is the value of using IDictionary here?
Started by oo on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
}
You can use it like this:
Dictionary<string, string> a = new Dictionary<string, string>(); SortedDictionary<string, string&....
A method like this:
void DoSomething(IDictionary<string, string> d) { //...
|
|
Hello,
I have this string: "\"Blah \'Blah\' Blah\"" . There is another string inside it. How do I convert that into: Blah 'Blah' Blah ? (you see, unescaping the string.) This is because I get a SQL Where query:
WHERE blah="Blah \'Blah\' Blah"
When I parse...
Started by Isaac Waller on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
This assumes that if it starts.
This should be about right.
Blah \'Blah\' Blah\"".replaceAll("\"", "")
Put the string in a property file, Java supports XML values into the String if needed.
|
|
Can someone explain to me why ServletRequest.getParameterMap() returns type
Map<String, String[]>
ServletRequest.getParameter() just returns type String
I'm don't understand why the map would ever map to more then one value. TIA.
Started by BillMan on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Opel</option> </select>
Any checked/selected values will come in as:
String[] cars.
|