Old Testament readings use the Septuagint , the Scripture the apostles quoted. Masoretic numbering shown for reference.Learn why
KJV

Psalms 18:23

I was also upright before him, and I kept myself from mine iniquity.

Read in other translations