I have a website where I need to parse date/time strings from receipts. These can be in a variety of different formats -- for instance, one string could be '11/04/2009 12:46PM', while another could be 'Mar06'09 10:57AM'. I need to get a standard date/time string out of them to do a database insert.
I'd like to avoid writing new php cod...
I was previously using the following code to determine if a file was an .exe or .o file and thus set binFile to 1:
if(strstr(fpath,".exe") != NULL || strstr(fpath,".o") != NULL)
binFile = 1;
Through debugging, I noticed that this method will also set binFile to 1 with files like foo.out or foo.execute. What I really want is...
In Python: how do I say:
line = line.partition('#' or 'tab')[0] ... do something with
I know I can do:
line = line.partition('#')[0] ... do something
But what is the code for the tab character, and can I say # or tab?
Update: I'm trying to say read the first word on each line, if you read a # then ignore everything after th...
I've been trying to figure out how to convert a string to a String in Visual Studio 2005 with no luck.
Here is the relevant code:
#include <string>
using namespace std;
#using <System.dll>
using namespace System;
string test = "a test string";
So I'm trying to convert test into a String^ to use inside other .NET classes, can anyone ...
I have a C string that looks like "Nmy stringP", where N and P can be any character. How can I edit it into "my string" in C?
...
An array of pointers to strings is provided as the input. The task is to reverse each string stored in the input array of pointers. I've made a function called reverseString() which reverses the string passed to it. This functions works correctly as far as i know.
The strings stored/referenced in the input array of pointers are sent on...
I am trying to write a method that uses recursion to compare the strings str1 and str2 and determine which of them comes first alphabetically (i.e., according to the ordering used for words in a dictionary).
If str1 comes first alphabetically, the method should return the integer 1.
If str2 comes first alphabetically, the method shoul...
I'm trying to write a method that uses recursion to print the string formed by "interleaving" the strings str1 and str2. In other words, it should alternate characters from the two strings: the first character from str1, followed by the first character from str2, followed by the second character from str1, followed by the second charact...
Here is a sample HTML document that I am passing as MemoryStream in the code as given below
<h5>Sample Document </h5>
<h3> Present Tense </h3>
</p><p>The present tense is just as you have learned. You take the dictionary form of a verb, drop the 다, add the appropriate ending.
</p><p>먹다 - 먹 + 어Ꮫ...
I want to change a String so that all the uppercase characters become lowercase, and all the lower case characters become uppercase. Number characters are just ignored.
so "AbCdE123" becomes "aBcDe123"
I guess there must be a way to iterate through the String and flip each character, or perhaps some regular expression that could do it....
I have a simple problem that says:
A password for xyz corporation is supposed to be 6 characters long and made up of a combination of letters and digits. Write a program fragment to read in a string and print out a message as to whether or not the string entered would be considered a valid password.
I need help on completing this code....
I'm attempting to write a Korn Shell function that uses printf to pad a string to a certain width.
Examples:
Call
padSpaces Hello 10
Output
'Hello '
I currently have:
padSpaces(){
WIDTH=$2
FORMAT="%-${WIDTH}.${WIDTH}s"
printf $FORMAT $1
}
Edit: This seems to be working, in and of itself, but when I ...
Hi,
I have information about 12340 cars. This info is stored sequentially in two different files:
car_names.txt, which contains one line for the name of each car
car_descriptions.txt, which contains the descriptions of each car. So 40 lines for each one, where the 6th line reads @CAR_NAME
I would like to do in python: to add for eac...
I'm having trouble with the logic of taking a paragraph of text and splitting it on words/sentences to send out in multiple text messages. Each text message can only have up to 160 characters. I want to cleanly break a paragraph up.
Here is the solution (thanks Leventix!):
public static function splitStringAtWordsUpToCharacterLimit($st...
Hi,
I'm designing an application that need to extract people's names from short texts.
What is the best way to do that? is there a database of names where I can test to know where is the name? the fact that the text is short it might not be as intensive in terms of processing needs.
Any ideas?
Thanks,
Tam
...
I'm trying to get a line as input from the command line. My problem is that I'm not getting the whole line, but it's being tokenized by space.
So if I entered something such as "I like Math a lot" instead of getting
"you enterend: I like Math a lot"
I get the follwoing:
EDITING MODE: Enter a command
i like Math a lot
you entered i
...
Hi All,
I'd like to change 2 byte in a string like this:
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Let's imagine I want to replace 'RS' by 11, I know how to do it with one byte like [:], but for 2 or more in the middle of the string ?
Thanks !
...
#include <stdio.h>
#include <string.h>
#include <conio.h>
#include <iostream>
using namespace std;
char a[21]; // If this is put inside the function unter -> junk output
char* b="";
void unter()
{
char *new_str = "";
strcpy(a, new_str);
char str_temp[10]="";
int chnum =0, neighbor1=3, neighbor2=...
Just curious, which is more efficient?
This:
String a = someString + "." + anotherString;
Or this:
String a = someString + '.' + anotherString;
...
Hi,
I've hit s small block with string parsing. I have a string like:
footage/down/temp/cars_[100]upper/cars[100]_upper.exr
and I'm having difficulty using gsub to delete a portion of the string. Normally I would do this
lineA = footage/down/temp/cars_[100]_upper/cars_[100]_upper.exr
lineB = footage/down/temp/cars_[100]_upper/
ne...