C++ Press Enter to Continue
This doesn't work: string temp; cout << "Press Enter to Continue"; cin >> temp; ...
This doesn't work: string temp; cout << "Press Enter to Continue"; cin >> temp; ...
Just getting into python, and so I decided to make a hangman game. Works good, but I was wondering if there was any kind of optimizations I could make or ways to clean up the code. Also, if anyone could recommend a project that I could do next that'd be cool. import sys import codecs import random def printInterface(lst, attempts): ...
I have a table column that I'm binding to a value in an NSArrayController. What I'm trying to do is display only a substring of the actual value in the array controller. The way I've been trying to do that so far is by creating an NSValueTransformer subclass, and then doing the string manipulation in the transformedValue method. Howev...
I'm working in Microsoft Visual C# 2008 Express with Sqlite. I understand that an apostrope (') in my text has problems in a query. My problem is that I thought I could replace it with \'. It doesn't seem to be working... Here's a parred down example of my code: string myString = "I can't believe it!"; cmd.CommandText = "Insert into ...
I'm attempting to do a simple bubble sort code to get familiar with list/string manip & method use, but for some reason, when I attempt to iterate through each value in the list to remove white space and values that are non ints, it skips some. I haven't even gotten to the bubble sorting part.. #test data: 45,5j, f,e,s , , , 45,q, ...
I want to build a list containing every possible permutation of capitalization of a word. so it would be List<string> permutate(string word) { List<string> ret = new List<string>(); MAGIC HAPPENS HERE return ret; } So say I put in "happy" I should get an array back of {happy, Happy, hAppy, HAppy, haPpy, HaPpy ... haPPY, H...
How should I get the number of characters in a string in C++? ...
I was reading the answers for this question and found that there is actually method called length() for strings (I always used size()). Is there any specific reason for having this method in string class ? I read both MSDN and CppRefernce and they seem to indicate that there is no difference between size() and length(). If that is so, is...
Hi How do i add a TAB (\t) to a string resource ? "\tText" doesn't work ...
Hello, I have a Map where Coords is defined as so: class Coords { int x; int y; public boolean equals(Object o) { Coords c = (Coords)o; return c.x==x && c.y==y; } public Coords(int x, int y) { super(); this.x = x; this.y = y; } public int hashCode() { return new Inte...
I want to make sure a string has only characters in this range [a-z] && [A-Z] && [0-9] && [-] so all letters and numbers plus the hyphen. I tried this... C# App: char[] filteredChars = { ',', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', '=', '{', '}', '[', ']', ':', ';', '"', '\'', '?', '/', '.', '<', '>', '\\...
Hi, I need to measure the distance between two strings (names of places). Since some times the names are written slightl differently I was looking for a library that could help me measure the difference and then combine it with a measure of the latitude and longitude to select the correct matches. Preferred languages: Java or Php Any s...
I have the following code: #include <string.h> int main(void) { char *buffer = NULL, **words = NULL, *aPtr = NULL, *sPtr; int count = 0; buffer = strdup("The quick brown fox jumps over the lazy dog"); sPtr = buffer; do { aPtr = strsep(&sPtr, " "); words[count++] = ... // missing code } while(aPtr); ...
I'm trying to use the str.find() and it keeps raising an error, what am I doing wrong? import codecs def countLOC(inFile): """ Receives a file and then returns the amount of actual lines of code by not counting commented or blank lines """ LOC = 0 for line in inFile: if...
or objThatIsString.ToString() as it was pointed out in the aswers .. Faster not wiser .. ...
In the following SQL query using the PreparedStatement class: String query_descrip = "insert into timitemdescription (itemkey, languageid, longdesc, shortdesc) values (?, 1033, ?,?)"; PreparedStatement pstmt2 = con.prepareStatement(query_descrip); pstmt2.setInt(1, rs4); pstmt2.setString(2, itemdescription); pstmt2.setString(3, itemdesc...
C#: What takes up more memory? A string or bytes? Let's say I have a line that reads "My Text", in which form would that line use up more memory, as a byte or a string? ...
I want to fit strings into a specific width. Example, "Hello world" -> "...world", "Hello...", "He...rld". Do you know where I can find code for that? It's a neat trick, very useful for representing information, and I'd like to add it in my applications (of course). Edit: Sorry, I forgot to mention the Font part. Not just for fixed widt...
I want to take the content of a website article and create two or more columns of text. The difficult part is that i must keep the html tags and also close them if the cutting is done inside a <p></p> for example. Example: <p><span>One two three <strong>four</strong></span> five six</p> Result: <p><span>One two three<span><p> <p><s...
Hello, I'm looking for a regular expression that will replace strings in an input source code with some constant string value such as "string", and that will also take into account escaping the string-start character that is denoted by a double string-start character (e.g. "he said ""hello"""). To clarify, I will provide some examples...