====== Function equivalents ====== Those pesky dialects! Here are some equivalent functions in various languages. ^Language ^Syntax ^Notes ^ ^Find the first occurrence of one string in another string ^^^ |C# |''haystack.IndexOf(needle);'' |Returns zero-indexed offset | |Excel |''=FIND(needle, haystack[, offset])'' |Case sensitive, ''offset'' indexed from 1 | |PHP |''strpos(haystack, needle);'' |Returns zero-indexed offset | |SSIS expressions |''FINDSTRING(haystack, needle, offset)'' |''offset'' indexed from 1 | |TSQL |''CHARINDEX(needle, haystack[, offset])'' |''offset'' indexed from 1 | ^Replace one substring with another in a containing string ^ |Excel |''=SUBSTITUTE(haystack, needle, new_needle[, occurrence_num])'' |Case-sensitive. ''occurrence_num'' specifies which occurrence to replace; default is all. | |TSQL |''REPLACE(haystack, needle, new_needle)'' |Replaces all occurrences | ^Replace a portion of a string with a new string ^ |Excel |''=REPLACE(haystack, offset, num_chars, new_needle)'' |''offset'' indexed from 1. Insert one string into another by replacing 0 characters at ''offset'' | |TSQL |''STUFF(haystack, offset, num_chars, new_needle)'' |''offset'' indexed from 1. Insert one string into another by replacing 0 characters at ''offset'' | ^Generate a string by repeating another one a number of times ^ |Excel |''=REPT(string, number_of_times)'' | | |TSQL |''REPLICATE(string, number_of_times)'' | | {{tag> excel tsql ssis csharp php}}