Science, Tech, Math › Computer Science Pos Function Share Flipboard Email Print Musketeer/DigitalVision/Getty Images Computer Science Delphi Programming Delphi Tutorials Advanced PHP Programming Perl Python Java Programming Javascript Programming C & C++ Programming Ruby Programming Visual Basic View More By Zarko Gajic Zarko Gajic Twitter Computer Science Expert MSCS, Computer Science, University of Osijek Zarko Gajic is experienced in SQL and has working knowledge of DB systems such as MS SQL Server, Firebird, Interbase, and Oracle. He is also proficient in XML, DHTML, and JavaScript. Learn about our Editorial Process Updated on January 28, 2019 The Pos function in Delphi returns an integer specifying the position of the first occurrence of one string within another. It's instantiated like this: Pos(String,Source); What It Does Pos looks for the first complete occurrence of the specified String — generally offered literally, in single quotes — in Source. The Source is usually some variable. If Pos finds the string, it returns the character position in Source of the first character in Str as an integer value, otherwise it returns 0. The String and the Source must both be strings. Example var s : string; i : integer; s:='DELPHI PROGRAMMING';i:=Pos('HI PR',s); In this example, the variable i will return the integer 5, because the specified string begins with the letter H, which is in the fifth position in Source. Cite this Article Format mla apa chicago Your Citation Gajic, Zarko. "Pos Function." ThoughtCo, Aug. 26, 2020, thoughtco.com/pos-function-4091945. Gajic, Zarko. (2020, August 26). Pos Function. Retrieved from https://www.thoughtco.com/pos-function-4091945 Gajic, Zarko. "Pos Function." ThoughtCo. https://www.thoughtco.com/pos-function-4091945 (accessed June 2, 2023). copy citation Featured Video