AndrewHoward 0 Posted November 5, 2020 Hi, Why do these two statemets give different results ? Pos('#$02','bla,bla,#$02,bla');// Pos = 9 const STX=#$02; Pos(STX,'bla,bla,#$02,bla'); // Pos = 0 Thanks Share this post Link to post
Kryvich 165 Posted November 5, 2020 const STX=#$02; isn't the same as const STX='#$02'; 2 Share this post Link to post
Rollo62 536 Posted November 5, 2020 https://stackoverflow.com/questions/6424510/removing-a-from-delphi-string 1 Share this post Link to post
Remy Lebeau 1393 Posted November 5, 2020 (edited) 40 minutes ago, AndrewHoward said: Why do these two statemets give different results ? '#$02' (w/ quotes) is a string literal consisting of 4 distinct characters: '#', '$', '0', '2'. The string you are searching, 'bla,bla,#$02,bla', contains that 4-char substring in it, hence the result is > 0. #$02 (w/o quotes) is a single Char whose numeric value is 2. The string you are searching does not contain that character in it, hence the result is 0. Edited November 5, 2020 by Remy Lebeau 2 1 Share this post Link to post