Hi,
I have a String and I want to get another string out of it which has only characters at odd occuring positions.
For example if i have a string called ABCDEFGH, the output I expect is ACEG since the character indexes are at 0,2,4,6 respectively. I did it using a loop, but there should be one line implementation in Ruby (perhaps usin...
i have a list
listcdtitles =
[""" Liszt, Hungarian Rhapsody #6 {'Pesther Carneval'}; 2 Episodes from Lenau's 'Faust'; 'Hunnenschlacht' Symphonic Poem. (NW German Phil./ Kulka) """,
""" Puccini, Verdi, Gounod, Bizet: Arias & Duets from Butterfly, Tosca, Boheme, Turandot, I Vespri, Faust, Carmen. (Fiamma Izzo d'Amico & Peter Dvorsk...
Hi
I have a string like:
text-345-3535
The numbers can change.
How can I get the two numbers from it and store that into two variables?
...
I'm doing C programming and need help with this problem..
char str[] = "Hello";
char * ptr = str;
char ** ptr2 = (char**)ptr;
I have these three lines in a header file. The first two lines are fine but an error will occur in the third line. Explicitly the error is "initializer element is not constant".
Is there any other way of assig...
I have a 2-dimensional array of pointer to char and initialising it in a header file.
The problem is this: it doesn't complain getting assigned a const char[] but does not like me assigning const char* (as shown in the code). It gives me an error "initializer element is not constant".
const char lang[8] = "English";
const char * langPt...
I have a list of people that I'd like to search through. I need to know 'how much' each item matches the string it is being tested against.
The list is rather small, currently 100+ names, and it probably won't reach 1000 anytime soon.
Therefore I assumed it would be OK to keep the whole list in memory and do the searching using somethin...
From my previous question, http://stackoverflow.com/questions/3571563/converting-chinese-character-to-unicode, I had a good answer but with some code I didn't understand:
Console.WriteLine("U+{0:x4}", (int)myChar);
Could anyone explain this?
...
How would you return part of a string based on the contents of the string in php. Unlike substr() and related functions where you use an integer length
So if we are given a string like this
here is a nice string that is being used as an example
How could we return a string like this
nice string
Somehow we have to pass the function a...
I want to generate a random list of strings containing only alphanumeric characters. The length of the string can be of any size. Is there any way to do this using recursion?
...
Hi all,
I'm trying to wrap NSLog function just to add some info every time I log something, but I have a problem.
The NSLog declaration is
void NSLog(NSString *format, ...) __attribute__((format(__NSString__,1,2)))
this allow to have multiple parameters in call as
NSLog(@"first %@ second %@ third %d,string,string,number);
My decl...
I need to convert a String representation of a nested List back to a nested List (of Strings) in Groovy / Java, e.g.
String myString = "[[one, two], [three, four]]"
List myList = isThereAnyMethodForThis(myString)
I know that there's the Groovy .split method for splitting Strings by comma for example and that I could use regular expres...
I want to use string Tokenizer for CPP string but all I could find was for Char*.
Is there anything similar for CPP string ?
Thanks in advance
...
I need to convert a navigable map to a 2d String array.Below given is a code from an answer to one of my previous question.
NavigableMap<Integer,String> map =
new TreeMap<Integer, String>();
map.put(0, "Kid");
map.put(11, "Teens");
map.put(20, "Twenties");
map.put(30, "Thirties");
map.put(40, "Forties");
map.put(50, "Senior");
...
Current function:
function SetPopup() {
x$('body').setStyle('overflow', 'hidden');
x$('#divOne').setStyle('height', document.body.offsetHeight + 'px');
x$('#divOne').setStyle('width', 100 + '%');
x$('#divOne').setStyle('display', 'block');
}
What I would like to do is change this function such that 'divOne' would be re...
This is my first question so hello to all users!
Is there a function in C# to quickly convert some collection to string and separate values with delimiter?
For example:
List<string> names --> string names = "John, Anna, Monica"
...
string sentence = "X10 cats, Y20 dogs, 40 fish and 1 programmer.";
string[] digits = Regex.Split (sentence, @"\D+");
for this code i get values in digits array like this 10,20,40,1
string sentence = "X10.4 cats, Y20.5 dogs, 40 fish and 1 programmer.";
string[] digits = Regex.Split (sentence, @"\D+");
for this code i get values i...
In WinForm, I have a combobox with DropDownStyle set to DropDownList (so can't enter a Text). In the properties window, there is the Items property which is a string collection. I enter all my values.
But now, I would like to set one of these value by default (instead to have the empty entry at run-time). I know how to do this via codin...
The code:
public Constructor(string vConnection_String)
{
try
{
mConnection_String = vConnection_String;
}
catch (Exception ex)
{
ExceptionHandler.CatchEx(ex);
}
}
I think the person who programmed this was "just being careful," but out of interest what exceptions could be thrown on ...
Is there an easy way to substitute a/an in a string to agree with the following word - much the same as the way 'S' works in Date format?
e.g.
$apple = 'apple';
$pear = 'pear';
echo "This is a $apple, this is a $pear."
--> This is an apple, this is a pear
...
I need to compare 2 strings and calculate their similarity, to filter down a list of the most similar strings.
Eg. searching for "dog" would return
dog
doggone
bog
fog
foggy
Eg. searching for "crack" would return
crack
wisecrack
rack
jack
quack
I have come across:
QuickSilver
LiquidMetal
Do you know of any more string simila...