Hello, I have a scientific application for which I want to input initial values at runtime. I have an option to get them from the command line, or to get them from an input file. Either of these options are input to a generic parser that uses strtod to return a linked list of initial values for each simulation run. I either use the co...
char character = 'c';
string str = null;
str = character.ToString();//this is ok
char[] arrayChar = { 'a', 'b', 'c', 'd' };
string str2 = null;
str2 = string.Copy(arrayChar.ToString());//this is not ok
str2 = arrayChar.ToString();//this is not ok.
I'm trying to converting char ar...
I need to write a program that takes two strings as arguments and check if the second one is a substring of the first one. I need to do it without using any special library functions. I created this implementation, but I think it's always returning true as long as there is one letter that's the same in both strings. Can you help me out h...
Using regexp with tokens on cell array of strings I've got cell array of cells. Here is simplified example:
S = {'string 1';'string 2';'string 3'};
res = regexp(S,'(\d)','tokens')
res =
{1x1 cell}
{1x1 cell}
{1x1 cell}
res{2}{1}
ans =
'2'
I know I have only one match per cell string in S. How I can convert this outp...
Hi All,
I am using the following function to loop through a couple of open CDB hash tables. Sometimes the value for a given key is returned along with an additional character (specifically a CTRL-P (a DLE character/0x16/0o020)).
I have checked the cdb key/value pairs with a couple of different utilities and none of them show any addit...
Hello all,
I'm trying to find a Delphi function that will split an input string into an array of strings based on a delimiter. I've found a lot on Google, but all seem to have their own issues and I haven't been able to get any of them to work.
I just need to split a string like:
"word:doc,txt,docx" into an array based on ':'. The res...
I have been working on two methods that will Transpose and Untranspose a String respectively. The solutions that I have come up with both work to the best of my knowledge. I just want to know if I could have solved these problems in a simpler way. My code seems like it is too long for the task that is being performed. The first method, t...
Trying to override a tostring in one of my classes.
return string.Format(@" name = {0}
ID = {1}
sec nr = {2}
acc nr = {3}", string, int, int ,int); // types
But the thing is, the result isn't aligned when printed out:
name = test
...
Hello all, I have a question regarding the some data which is being transfered from one form to my class. It's not going quite the way i'd like to , so I figured maybe there is someone who could help me.
This is my code in my class
Public Class DrawableTextBox
Inherits Drawable
Dim i_testString As Integer
Private s_InsertLabel A...
I have a bit of text
"this is the text want I want to do is replace the text, I have just added another is for good measure"
This is stored as a standard string but I want to turn this into html and add css classes like, in this example wrapping around the word "is";
"this is the text want I want to do
is replace the text, I have ju...
I have a question, which Unicode encoding to use while encoding .NET string into base64? I know strings are UTF-16 encoded on Windows, so is my way of encoding is the right one?
public static String ToBase64String(this String source) {
return Convert.ToBase64String(Encoding.Unicode.GetBytes(source));
}
...
How can I use IndexOf with SubString to pick a specific Character when there are more than one of them? Here's my issue. I want to take the path "C:\Users\Jim\AppData\Local\Temp\" and remove the "Temp\" part. Leaving just "C:\Users\Jim\AppData\Local\" I have solved my problem with the code below but this assumes that the "Temp" folder is...
How do I concatenate 2 strings in NSIS?
...
Why does the first if statement evaluate to true? I know if I use "is" instead of "=" then it won't evaluate to true. If I replace String.Empty with "Foo" it doesn't evaluate to true. Both String.Empty and "Foo" have the same type of String, so why does one evaluate to true and the other doesn't?
//this evaluates to true
If N...
int d;
d = some_string.IndexOf("something",1000);
I want indexOf to search some_string, starting at position 1000 and searching backwards. is this possible?
...
how to convert string to integer??
for ex:
"5328764",to int base 10
"AB3F3A", to int base 16
any code will be helpfull
...
Hey there,
I know this can't be that hard. I've searched, but I can't seem to find a simple solution. I want to call a method, pass it the length and have it generate a random alphanumeric string.
Any ideas? Are there any utility libraries out there that may have a bunch of these types of functions?
Thanks,
Howie
...
I am trying to convert a string I read in from a file to an int value so I can store it in an integer variable. This is what my code looks like:
ifstream sin;
sin.open("movie_output.txt");
string line;
getline(sin,line);
myMovie.setYear(atoi(line));
Over here, setYear is a mutator in the Movie class (myMovie is an object of Mo...
Here's a fun one I've been trying to figure out. I have the following program:
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main(int argc, char *argv[])
{
string s("5");
istringstream stream(s);
double theValue;
stream >> theValue;
cout << theValue << endl;
cout << stream...
1) Is there any built-in which can tell me if a variable's contents contain only uppercase letters?
2) is there any way to see if a variable contains a string? For example, I'd like to see if the variable %PATH% contains Ruby.
...