String.indexOf function in C

String.indexOf function in C

Is there a C library function that will return the index of a character in a string? So far, all I've found are functions like strstr that will return the found char*, not it's location in the origi…


Replacing the nth instance of a regex match in Javascript

I'm trying to write a regex function that will identify and replace a single instance of a match within a string without affecting the other instances. For example, I have this string: 12||34||56 I…


Eclipse text comparison order

I'm using Eclipse 3.4(on Mac) and I've got an annoyance with the text comparison having the files I'm comparing in a specific order which is not what I want. When I compare two files it always seems…


How do I replace the*first instance* of a string in.NET?

I want to replace the first occurrence in a given string. How can I accomplish this in.NET?…


command line - How to use sed to replace only the first occurrence in a file?

I want to update a large number of C++ source files with an extra include directive before any existing#includes. For this sort of task I normally use a small bash script with sed to re-write the fil…


How to Regex search/replace only first occurrence in a string in.NET?

It seems the.NET Regex.Replace method automatically replaces all matching occurrences. I could provide a MatchEvaluator delegate that returns the matched string after the first replacement, renderi…


Search for text between delimiters in MySQL

I am trying to extract a certain part of a column that is between delimiters. e.g. find foo in the following test 'esf:foo: bar So in the above I'd want to return foo, but all the regexp functions o…



ColdFusion and trailing comma

How do I remove a trailing comma from a string in ColdFusion?…


c# - Get the index of the nth occurrence of a string?

Unless I am missing an obvious built-in method, what is the quickest way to get the nth occurrence of a string within a string? I realize that I could loop the IndexOf method by updating its start ind…


java - How do I count the number of occurrences of a char in a String?

I have the string a.b.c.d I want to count the occurrences of '.' in an idiomatic way, preferably a one-liner.(Previously I had expressed this constraint as "without a loop", in case you're wonderin…




string character find first last regex how replace occurrences java