Hi,
I'd like to output some data to a file. For example assume I have two vectors of doubles:
vector<double> data1(10);
vector<double> data2(10);
is there an easy way to output this to a file so that the first row contains the headings 'data1' and 'data2' followed by the actual contents. The function which
outputs the data will b...
Strings that match /^\w+$/ are quite common. For example many authentication systems use that pattern to validate usernames. I'm wondering if a term exists that identifies this kind of strings.
I've been thinking of the term "alphanumeric" but is a string alphanumeric if it contains an underscore?
...
I've got a list of names separated by commas (they may contain other characters), or be empty, but generally looking like this:
NameA,NameB,NameC
I need to create a function to delete a name if its present in the list and which restores the comma separated structure.
eg: if NameA is to be deleted, I should end up with:
NameB,NameC
...
If I were creating a videogame level editor in AS3 or .NET with a string-based level format, that can be copied, pasted and emailed, how much data could I encode into each character? What is important is getting the maximum amount of data for the minimum amount of characters displayed on the screen, regardless of how many bytes the compu...
How-Do/Can I set the value of a String object in Java (without creating a new String object)?
Thanks,
Chenz
...
Why would myString.Contains(" ") or myString.IndexOf(' ') throw a FormatException "Invalid name format"? This exception is only thrown when there is a space in myString.
...
How can I check if any of the strings in an array exists in another string?
Like:
a = ['a', 'b', 'c']
str = "a123"
if a in str:
print "some of the strings found in str"
else:
print "no strings found in str"
That code doesn't work, it's just to show what I want to achieve.
...
I'm trying to speed up the following:
string s; //--> s is never null
if (s.Length != 0)
{
<do something>
}
Problem is, it appears the .Length actually counts the characters in the string, and this is way more work than I need. Anybody have an idea on how to speed this up?
Or, is there a way to determine if s[0] exists, w/out ch...
(My apologies, this is a 2nd post to http://stackoverflow.com/questions/3390175/most-efficient-way-to-determine-if-a-string-length-0 but I can't figure out how to reply to people's answers, my reply becomes posted as an 'answer')
Ideally, what I'm looking for is the most efficient algorithm to do the following (which will be called 100m...
What is an efficient way to repeat a string to a certain length? Eg: repeat('abc', 7) -> 'abcabca'
Here is my current code:
def repeat(string, length):
cur, old = 1, string
while len(string) < length:
string += old[cur-1]
cur = (cur+1)%len(old)
return string
Is there a better (more pythonic) way to do this...
string[] pullspec = File.ReadAllLines(@"C:\fixedlist.txt");
foreach (string ps in pullspec)
{
string pslower = ps.ToLower();
string[] pslowersplit = pslower.Split('|');
var keywords = File.ReadAllLines(@"C:\crawl\keywords.txt");
if (pslower.Contains("|"))
{
...
How can I tell if a string contains something? Something like:
if([someTextField.text containsString:@"hello"]) {
}
...
I'd like to create a gql query through my browser dashboard to easily look up specific entries, i.e. something like:
SELECT * FROM MyEntity where mString = "SpecificEntity"
but I can't quite get the syntax right. I see a lot of examples using parameter binding/substitution (not sure what it is called), but I don't know how to simply ...
Hello,
Is it possible to see strings that use 16 bits chars in Xcode debugger? I use a custom string class, not NSString. The strings are NULL terminated. The only way I can see the strings is if I see them as memory, but they are hard to read.
Thank you!
...
I have an array "$abc" which has 9 elements, as:-
Array
(
[a] => Jack
[b] => went
[c] => up
[d] => the
[e] => hill
[f] => but
[g] => never
[h] => came
[i] => back
)
Now I need to concat only the 4 elements starting from the "b" index to the "e" index only. But I don't know what to do. I used the "im...
I have an array of type object which are strings.
I would like to convert them to strings
what would be the quickest way of doing so.
Eg.
I have this "object[]" and want to convert it so it is this "string[]"
UPDATE -
i think the problem is that some of the objects on the object[] are actually other objects like integers. I would ...
I have developed an asp.net web application containing 40-50 pages. I have implemented logger using Log4net and each of my pages has this in its page_load event
protected void Page_Load(object sender, EventArgs e)
{
try
{
log.Debug("In Page Load Function");
if (!IsPostBack)
{
...
What's happening behind the scenes when I do a concatenation on a string?
my $short = 'short';
$short .= 'cake';
Is Perl effectively creating a new string, then assigning it the correct variable reference, or are Perl strings always mutable by nature?
The motivation for this question came from a discussion I had with a colleague, who...
Hi all,
I'm going nuts with this...let me explain...
I have a very simple Bash script with a function in it that receives 3 arguments. Those arguments are all strings. Everything was working fine 'til I had to pass a string with whitespaces to the function.
I also have some test code to call the function (whose name is substracFromF...
Greetings all,
ERROR:
Program received signal 'SIGSEGV', Segmentation fault.
I am having some issues with the following code creating the above fault in Code::Blocks. It is for a chatbox I am using for a network chat program where the vector is filled with the strings of text for each line of the chat log. I don't see why its throwing...