I'm trying to test for a /t or a space character and I can't understand why this bit of code won't work. What I am doing is reading in a file, counting the loc for the file, and then recording the names of each function present within the file along with their individual lines of code. The bit of code below is where I attempt to count th...
Example: "20080807144334.410187-180" (-180 means GMT minus three hours. Rio de Janeiro in this case.)
That string format is returned when I query file creation/change/access times via WMI (that is not totally working; see here). I guess I could parse it the idiot way, extracting year, month etc. from the string positions. But I'd like n...
I have a dictionary which store a string as the key, and an integer as the value. In my output I would like to have the key displayed as a string without parenthesis or commas. How would I do this?
for f_name,f_loc in dict_func.items():
print ('Function names:\n\n\t{0} -- {1} lines of code\n'.format(f_name, f_loc))
output:
En...
So I have something like this
public string? SessionValue(string key)
{
if (HttpContext.Current.Session[key].ToString() == null || HttpContext.Current.Session[key].ToString() == "")
return null;
return HttpContext.Current.Session[key].ToString();
}
which doesn't compile.
How do I return a nullable string type?
...
I can't see why this won't work. I am performing lstrip() on the string being passed to the function, and trying to see if it starts with """. For some reason, it gets caught in an infinite loop
def find_comment(infile, line):
line_t = line.lstrip()
if not line_t.startswith('"""') and not line_t.startswith('#'):
print (...
I have a database full of names like:
John Smith
Scott J. Holmes
Dr. Kaplan
Ray's Dog
Levi's
Adrian O'Brien
Perry Sean Smyre
Carie Burchfield-Thompson
Björn Árnason
There are a few foreign names with accents in them that need to be converted to strings with non-accented characters.
I'd like to convert the full names (...
It is common to have classes with methods with string parameters that must be validated agains null or empty, such as this example:
public class MyClass {
public void MyMethod(string param){
if(string.IsNullOrEmpty(param)){
throw new ArgumentNullException(...);
}
//...
}
}
It's clear that ...
So you know off the bat, this is a project I've been assigned. I'm not looking for an answer in code, but more a direction.
What I've been told to do is go through a file and count the actual lines of code while at the same time recording the function names and individual lines of code for the functions. The problem I am having is dete...
I need to check whether an std:string begins with "xyz". How do I do it without searching through the whole string or creating temporary strings with substr().
Thanks.
...
Given a string text which contains newline there is a search keyword which matches an item within the text.
How do I implement the following in C#:
searchIdx = search index (starting with 0, then 1, etc. for each successive call to GetSearchContext. Initially start with 0.
contextsTxt = string data to search in
searchTxt = keyword t...
We're in the final stages of shipping our console game. On the Wii we're having the most problems with memory of course, so we're busy hunting down sloppy coding, packing bits, and so on.
I've done a dump of memory and used strings.exe (from sysinternals) to analyze it, but it's coming up with a lot of gunk like this:
''''$$$$ %%%%
...
I need a simple program that given a string, returns to me the next one in the alphanumeric ordering (or just the alphabetic ordering).
f("aaa")="aab"
f("aaZ")="aba"
And so on.
Is there a function for this in one of the modules already?
...
Considering the class below
- can I do anything to implement a case-insensitive string?
public class Attibute
{
// The Name should be case-insensitive
public string Name
{
get;
set;
}
public Attibute()
{
}
}
public class ClassWithAttributes
{
private List<Attributes> _attributes;
p...
the most efficient way?
...
A plain text file made up of paragraphs and some blank lines is loaded into an array via Ajax. The array is split into elements by new lines, such as:
var infoArray = new Array();
infoArray = response.split("\n");
Then the array is put through a for loop, with various tests for keywords in various elements, which indicate the next n-e...
I've been given a homework assignment to write a program in C++, but we're not allowed to use the string class. However, we are allowed to use the iostream library, including stringstream. I was thinking of using stringstream where I would have used string for building my classes, returning from functions, etc.
Does this sound like a go...
I'm not new to Python but a complete newbie with regular expressions (on my to do list)
I am trying to use python re to convert a string such as
[Hollywood Holt](http://www.hollywoodholt.com)
to
<a href="http://www.hollywoodholt.com">Hollywood Holt</a>
and a string like
*Hello world*
to
<strong>Hello world</strong>
...
I have an Employee model that has a SecurityClearanceLevel. When you make a new employee, you're asked to set a SecurityClearanceLevel by choosing from a <select> list. The problem is that when I save the object, it's a string, not a SecurityClearanceLevel, so the save fails.
Where do I take care of this kind of back-and-forth conversio...
I wish to get a list of all strings that are used in a .NET assembly including the “static” values that local variables are set to, parameters passed to methods, fields at set to, etc.
I recall from something I read a long time ago that a .NET assembly contains a tables of all strings it uses (or they can be "interned")– or am I just dr...
I have an array full of user logins that was loaded from the database. What's the simplest and efficient way to keep only the logins that contain non-ascii characters?
logins = Users.find(:all).map{|user|user.login}
logins_with_non_ascii_characters = logins.select{ |login| ...??? }
Thanks
Edit: if you have a SQL solution (I use MySQ...