Hey all.
I create the following for truncating a string in java to a new string with a given number of bytes.
String truncatedValue = "";
String currentValue = string;
int pivotIndex = (int) Math.round(((double) string.length())/2);
while(!truncatedValue.equals(currentValue)){
currentValue ...
Using printf i could specify the precision value as an extra parameter using *. Does the same functionality exist in the C# String.Format?
edit: For example:
Console.WriteLine("{0:D*}",1,4); // Outputs 0001;
...
How do you the following: given a string, generate all the possible ways to parse that string into substrings (time is important, space dont' care).
For example, given the string ABCD, I need to generate:
ABCD
A BCD
A BC D
A B CD
AB CD
AB C D
ABC D
A B C D
Probably a recursive solution, but I can't quite get it to work.
...
Pretty much what it says up there.
Basically, how do I get the string produced by
print "%05d" % 100
...
I have encountered a function, such that it can differentiate between being called as
foo("bar");
vs
const char *bob = "bar";
foo(bob);
Possibilities I have thought of are:
Address of string: both arguments sat in .rdata section of the image. If I do both calls in the same program, both calls receive the same string address.
RTTI...
hello all,
I've written a function in c that converts a byte (unsigned char) BCD string into ASCII. Please have look at the code and advice some improvements.
Is there any other efficient way that can convert BYTE BCD to ASCII.
BYTE_BCD_to_ASC(BYTE *SrcString, char *DesString)
{
switch (((BCD *)SrcString)->l)
{
...
In Java, the class String implements Comparable, which means there's a total ordering on the String objects. This ordering is referred to as the class's natural ordering, and the class's compareTo method is referred to as its natural comparison method. The set of String objects is also countable in the mathematical sense.
I need a func...
I have a directory with files
heat1.conf
heat2.conf
...
heat<n>.conf
minimize.conf
...
other files....
I want my Bash script to be able to grab the highest number filename (so I can delete and replace it when I find an error condition).
What's the best way to accomplish this?
Please discuss the speed of your solution and why you thi...
Possible Duplicate:
Encrypt/Decrypt string in .NET
I've been searching all over Google for a simple way to do this, but they don't work in C# 4.0 which I'm using. I have a textbox where i input the string i want to encrypt, and then it encrypts that text and displays the encrypted version of the text on a label. Then, they put...
C++: Using and returning character arrays from functions, return type or reference?
I'm trying to create a null terminated string outside of a function, then run a function which will assign some data to it. For example, char abc [80] is created in main. input() is then run, which will return user input to abc. I figure the two obviou...
I'm trying to make a timer in which you can insert how much time you want by clicking on the textview or some other button. My problem is I can not figure out how to get the code right so that it will set the string. The string is one that is set up before the class in the string xml. Here is the code that I am working with. This is the ...
Hey all,
Can anyone point me to an fxcop rule for identifing "string ==" usage. For example:
string s = "abc";
if (s == "def") {
// do somethign
}
I want the "if" statement raised as an error. Roughly speaking I want to always be using string.compare with the appropriate culture.
Thanks!
...
I've got a string split, using a regular expression.
Regex.Split(str, @"\s");
What does this convert to without regex? reason being I'm porting this to PHP and an SQL function. Unless you can show me the PHP code for the same...
...
In c# I am converting a byte to binary, the actual answer is 00111111 but the result being given is 111111. Now I really need to display even the 2 0s in front. Can anyone tell me how to do this?
I am using:
Convert.ToString(byteArray[20],2)
and the byte value is 63
...
I know we can use the charAt() method in Java get an individual character in a string by specifying its position. Is there an equivalent method in C#?
...
Actually i'm comparing two string which returns true when i use equals method. Whereas when i use compareTo method it returns 22.
Also i want to know at what place those two Strings differ. Using java how do i find this?
Thanks in advance.
...
What are the string patterns that we can use with findInLine() method. For example if input is an email address e.g [email protected], how do i find only "vinny.kinny" from the input using the findInLine() method in java.
...
Need to replace a char from another string.
$s1='123456789';
$s2='abcdefghi';
$p=4; // position of char in $s1 to use for replacing (0 is first char)
$s2 = ???? ; // code
In the end $s2 must be 'abcd5fghi'
What would be fastest method?
...
Hey,
I came across the task to find all occurences of a substring in another string and was wondering what will be the best algorithm to solve this problem.
For demonstration purposes I used the string "The cat sat on the mat" and search for all occurences of the substring "at". This should ultimately result in an occurence count of 3....
I want to add a set of (double) quotes to a python string if they are missing but the string can also contain quotes.
The purpose of this is to quote all command that are not already quoted because Windows API requires you to quote the entire command line when you execute a process using _popen().
Here are some strings that should be q...