Hey Folks,
strcmp, when fed the results of strtok, in the following code seems to be blatantly lying to me.
int fSize;
char * buffer=NULL;
char * jobToken = "job";
char * nextToken=NULL;
job * curJob=NULL;
struct node * head=NULL;
struct node * parseList(FILE* file){
fseek(file,0,SEEK_END);
fSize=ftell(file);
buffer = (cha...
Hi there
What is the fastest way to replace all instances of a string/character in a string in Javascript? A while, a for-loop, a regular expression?
Thanks in advance.
...
Hi,
I have the following string variables:
string feedImage ="http://im.media.ft.com/m/img/rss/RSS_Default_Image.gif"
rssImageStyle = "style=\"background-image:url(\'" + feedImage + "\')\"";
I want it to output the following html
background-image: url('http://im.media.ft.com/m/img/rss/RSS_Default_Image.gif');
But I get
back...
How can I write a function in Haskell, that takes an input string in the format a1a2a3 and expands into a1a2a2a3a3a3. For example input string "code" would be expanded into "coodddeeee"
...
I want to find the first index of substrings in a larger string. I only want it to match whole words and I'd like it to be case-insensitive, except that I want it to treat CamelCase as separate words.
The code below does the trick, but it's slow. I'd like to speed it up. Any suggestions? I was trying some regex stuff, but couldn't f...
Is there an equivalent in Javascript to the C function strncmp? Strncmp takes two string arguments and an integer length argument. It would compare the two string up to length and determine if they were equal as far as length went.
Does javascript have an equivalent built in function?
...
I'm working on an anti-plagiarism project for my CS class. This involves detecting plagiarism in computer science courses (programming assignments), through a technique described "Winnowing: Local Algorithms for Document Fingerprinting."
Basically, I'm taking a group of programming assignments. Lets say one of the assignments looks lik...
Hi All,
I have a string with multiple sentences. How do I Capitalize the first letter of first word in every sentence. Something like paragraph formatting in word.
eg ."this is some code. the code is in C#. "
The ouput must be "This is some code. The code is in C#".
one way would be to split the string based on '.' and then capital...
In a sh shell script.
Given data in a text file:
string1
string2 gibberish
gibberish
string3 gibberish
string4
How could you use awk or sed to remove all lines between string2(inclusive) and string3(not including string 3)?
to end up with:
string1
string3
string4
...
I've got the following method:
public static string ReturnFormat(string input, int maxLength, int decimalPrecision, char formatChar)
{
string[] format = new string[2];
string[] inputs = new string[2];
inputs = input.Split(CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator[0]);
if (input.Length > maxLength)
...
I would like to parse strings with an arbitrary number of parameters, such as P1+05 or P2-01 all put together like P1+05P2-02. I can get that data from strings with a rather large (too much to post around...) IF tree and a variable keeping track of the position within the string. When reaching a key letter (like P) it knows how many char...
Hi there,
I want to read a string that looks exactly like this:
VPSProtocol=2.22
Status=OK
StatusDetail=0000 : The Authorisation was Successful.
VPSTxId={BBF09A43-913E-14E3-B41B-E5464B6FF8A9}
SecurityKey=EH8VFZUSH9
TxAuthNo=4979698
AVSCV2=SECURITY CODE MATCH ONLY
AddressResult=NOTMATCHED
PostCodeResult=NOTMATCHED
CV2Result=MATCHED
CAVV...
How do I perform case insensitive string comparison in Javascript.
...
In the process of converting a C# application to Java, I came across the use of String's TrimEnd method. Is there an equivalent Java implementation? I can't seem to find one.
I'd rather not replace it with trim, since I don't want to change the meaning or operation of the program at this point unless I have to.
...
I have strings in my python application that look this way:
test1/test2/foo/
Everytime I get such a string, I want to reduce it, beginning from the tail and reduced until the fist "/" is reached.
test1/test2/
More examples:
foo/foo/foo/foo/foo/ => foo/foo/foo/foo/
test/test/ => test/
how/to/implement/this => how/to/imp...
I wonder if there is an easy and efficient way in SQL Server 2005 to eliminate replicated characters in a string. Like converting
'ABBBCDEEFFFFG' to 'ABCDEFG'
It really sucks that SQL Server has such a poor string library and no ready-to-use regexp feature...
...
I have a String variable which has dynamic user entered text
EX:- <cfset setPars="SPTO_DATE('04/11/2009 11:59:59 PM', 'MM/DD/YYYY HH:MI:SS AM')SP(L','MN)>'
Now If I use SP as the delimiter
in CFloop as below
<cfloop index="i" from="1" To="#ListLen(setPars,'SP')#">
<br/> #ListGetAT(setPars,i,'SP')#
</cfloop>
I am ge...
I have an NSString with a number of sentences, and I'd like to split it into an NSArray of sentences. Has anybody solved this problem before? I found enumerateSubstringsInRange:options:usingBlock: which is able to do it, but it looks like it isn't available on the iPhone (Snow Leopard only). I thought about splitting the string based on ...
I am trying to get this method in a String Filter working:
public function truncate($string, $chars = 50, $terminator = ' …');
I'd expect this
$in = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWYXZ1234567890";
$out = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV …";
and also this
$in = "âãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿĀā...
My input consists of user-posted strings.
What I want to do is create a dictionary with words, and how often they've been used.
This means I want to parse a string, remove all garbage, and get a list of words as output.
For example, say the input is :
"#@!@LOLOLOL YOU'VE BEEN *PWN3D* ! :') !!!1einszwei drei !"
The output I need is the...