In C# the string keyword (highlighted in Visual Studio as a data type) is just a shortcut to the String class right?
In that case, it would be the same to use either while coding from the semantic point of view. However, is it the same from the performance point of view? I mean, when the mapping is performed: during compilation (I guess...
I am parsing an input text file. If I grab the input one line at a time using getline(), is there a way that I can search through the string to get an integer? I was thinking something similar to getNextInt() in Java.
I know there has to be 2 numbers in that input line; however, these values will be separated by one or more white spa...
What's the best way to pipe the output from an java.io.OutputStream to a String in Java?
Say I have the method:
writeToStream(Object o, OutputStream out)
Which writes certain data from the object to the given stream. However, I want to get this output into a String as easily as possible.
I'm considering writing a class like this (...
Would you tell me, please, when should I use N prefix before string in Transact-SQL query? I have started to work with a database where I don't get any results using query like this
SELECT * FROM a_table WHERE a_field LIKE '%а_pattern%'
until I change pattern to N'%а_pattern%'. I never had to add this prefix in the past, so I am curio...
Hi,
What's the easiest way of me converting the simpler regex format that most users are used to into the correct re python regex string?
As an example, I need to convert this:
string = "*abc+de?"
to this:
string = ".*abc.+de.?"
Of course I could loop through the string and build up another string character by character, but that...
Hi all,
I was wondering if there is a native C++ (or STL/Boost) function which will search a CString for a specified string?
e.g.
CString strIn = "Test number 1";
CString strQuery = "num";
bool fRet = SomeFn(strIn, StrQuery);
if( fRet == true )
{
// Ok strQuery was found in strIn
...
I have found a small number of functions lik...
Is there support in Ruby for (for lack of a better word) non-escaped (verbatim) strings?
Like in C#:
@"c:\Program Files\"
...or in Tcl:
{c:\Program Files\}
...
I want to find a linux command that can return a part of the string. In most programming languages, it's the substr() function. Does bash have any command that can be used for this purpose. I want to be able to do something like this...
substr "abcdefg" 2 3 - prints 'cde'
Subsequent similar question:
http://stackoverflow.com/questio...
What I'm looking for is a basic equivalent of JavaScript's Array::join() whereby you pass in a separator character and uses that in its return string of all the subscripts. I could certainly write my own function using a StringBuilder or whatnot, but there must be something built into the .NET BCL.
EDIT: Array of anything, not necessar...
I have an excel sheet full of times.
They are formatted so that they look like: 1:00:15
However if I change the format on the cells to text, they change to the underlying numeric representation of the time: 0.041840278
How can I convert the cells to be text cells but still have the time in them ?
...
As an example, if I have the string:
".....ZZ..ZZ....."
or
".Z.1.Z.23Z.4.Z55"
is there an easy way that I can shift each Z in that string one space to the right?
Thanks in advance,
Tomek
Some additional test strings:
".Z"
"Z."
"ZZ."
".ZZ"
"Z"
"ZZ"
"ZZZ"
I think a few of the higher voted answers to this question (including the cu...
What is the Perl equivalent of strlen()?
...
I have a string (char) and I want to extract numbers out of it.
So I have string: 1 2 3 4 /0
And now I want some variables, so I can use them as integer: a=1, a=2, a=3, a=4
How can I do that?
...
What regex pattern would need to pass to the java.lang.String.split() method to split a string with all whitespace characters (' ', '\t', '\n', etc.) as delimiters?
...
For example, Convert.ToDouble("0.1234567890123456789") = 0.123456789012346
What is the maximum number of significant figures? Couldn't find it in the docs.
...
Someone told me that it's faster to concatenate strings with StringBuilder. I have changed my code but I do not see any Properties or Methods to get the final build string.
How can I get the string?
...
If I want to check for the null string I would do
[ -z $mystr ]
but what if I want to check whether the variable has been defined at all? Or is there no distinction in bash scripting?
...
We try to convert from string to Byte[] using the following Java code:
String source = "0123456789";
byte[] byteArray = source.getBytes("UTF-16");
We get a byte array of length 22 bytes, we are not sure where this padding comes from?
how do i get an array of length 20?
...
Hi,
I am trying to manipulate a string using Jython, I have included below an example string:
This would be a title for a website :: SiteName
This would be a title for a website :: SiteName :: SiteName
I am trying to remove all instances of ":: Sitename" or ":: SiteName :: SiteName", can anyone help me out? Cheers
...
After reading this old article measuring the memory consumption of several object types, I was amazed to see how much memory Strings use in Java:
length: 0, {class java.lang.String} size = 40 bytes
length: 7, {class java.lang.String} size = 56 bytes
While the article has some tips to minimize this, I did not find them entirely satisfy...