August 23, 200718 yr Newbies I have a situation where i need to count the number of leading spaces in a text field. Does anyone have thoughts on how to do this. Please keep in mind that spaces could be anywhere in the text, including trailing. I only wan to count the leading spaces. Thanks
August 23, 200718 yr This seems to work, if your first character other than a space is an letter or digit. It considers punctuation (incl. #@-_., etc.) to be the same as a space however. Let ( word1 = LeftWords ( Text_; 1 ); Position ( Text_ ; word1 ; 1 ; 1 ) - 1 )
August 23, 200718 yr Hi you can try this calc too... Length ( GetValue ( Substitute ( yourField ; Trim ( yourField ) ; ¶ ) ; 1 ) ) This counts the leading spaces whatever char is after them. ( and counts the spaces even if there aren't chars ! )
August 23, 200718 yr ... and, to count the trailing spaces: Length ( GetValue ( Substitute ( yourField ; Trim ( yourField ) ; ¶ ) ; 2 ) )
Create an account or sign in to comment